Skip to content

Commit

Permalink
Upgrade v8 to 1.3.11
Browse files Browse the repository at this point in the history
  • Loading branch information
ry committed Sep 17, 2009
1 parent 605b7e9 commit ab530bb
Show file tree
Hide file tree
Showing 56 changed files with 1,881 additions and 828 deletions.
13 changes: 13 additions & 0 deletions deps/v8/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
2009-09-15: Version 1.3.11

Fixed crash in error reporting during bootstrapping.

Optimized generated IA32 math code by using SSE2 instructions when
available.

Implemented missing pieces of debugger infrastructure on ARM. The
debugger is now fully functional on ARM.

Make 'hidden' the default visibility for gcc.


2009-09-09: Version 1.3.10

Fixed profiler on Mac in 64-bit mode.
Expand Down
34 changes: 30 additions & 4 deletions deps/v8/SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -96,25 +96,33 @@ ANDROID_LINKFLAGS = ['-nostdlib',

LIBRARY_FLAGS = {
'all': {
'CPPDEFINES': ['ENABLE_LOGGING_AND_PROFILING'],
'CPPPATH': [join(root_dir, 'src')],
'regexp:native': {
'CPPDEFINES': ['V8_NATIVE_REGEXP']
},
'mode:debug': {
'CPPDEFINES': ['V8_ENABLE_CHECKS']
},
'profilingsupport:on': {
'CPPDEFINES': ['ENABLE_LOGGING_AND_PROFILING'],
},
'debuggersupport:on': {
'CPPDEFINES': ['ENABLE_DEBUGGER_SUPPORT'],
}
},
'gcc': {
'all': {
'CCFLAGS': ['$DIALECTFLAGS', '$WARNINGFLAGS'],
'CXXFLAGS': ['$CCFLAGS', '-fno-rtti', '-fno-exceptions'],
},
'visibility:hidden': {
# Use visibility=default to disable this.
'CXXFLAGS': ['-fvisibility=hidden']
},
'mode:debug': {
'CCFLAGS': ['-g', '-O0'],
'CPPDEFINES': ['ENABLE_DISASSEMBLER', 'DEBUG'],
'os:android': {
'CPPDEFINES': ['ENABLE_DEBUGGER_SUPPORT'],
'CCFLAGS': ['-mthumb']
}
},
Expand All @@ -123,7 +131,7 @@ LIBRARY_FLAGS = {
'-ffunction-sections'],
'os:android': {
'CCFLAGS': ['-mthumb', '-Os'],
'CPPDEFINES': ['SK_RELEASE', 'NDEBUG', 'ENABLE_DEBUGGER_SUPPORT']
'CPPDEFINES': ['SK_RELEASE', 'NDEBUG']
}
},
'os:linux': {
Expand Down Expand Up @@ -229,7 +237,6 @@ LIBRARY_FLAGS = {
V8_EXTRA_FLAGS = {
'gcc': {
'all': {
'CXXFLAGS': [], #['-fvisibility=hidden'],
'WARNINGFLAGS': ['-Wall',
'-Werror',
'-W',
Expand Down Expand Up @@ -576,6 +583,16 @@ SIMPLE_OPTIONS = {
'default': 'static',
'help': 'the type of library to produce'
},
'profilingsupport': {
'values': ['on', 'off'],
'default': 'on',
'help': 'enable profiling of JavaScript code'
},
'debuggersupport': {
'values': ['on', 'off'],
'default': 'on',
'help': 'enable debugging of JavaScript code'
},
'soname': {
'values': ['on', 'off'],
'default': 'off',
Expand Down Expand Up @@ -615,6 +632,11 @@ SIMPLE_OPTIONS = {
'values': ['on', 'off'],
'default': 'off',
'help': 'more output from compiler and linker'
},
'visibility': {
'values': ['default', 'hidden'],
'default': 'hidden',
'help': 'shared library symbol visibility'
}
}

Expand Down Expand Up @@ -794,6 +816,10 @@ def PostprocessOptions(options):
# Print a warning if arch has explicitly been set
print "Warning: forcing architecture to match simulator (%s)" % options['simulator']
options['arch'] = options['simulator']
if (options['prof'] != 'off') and (options['profilingsupport'] == 'off'):
# Print a warning if profiling is enabled without profiling support
print "Warning: forcing profilingsupport on when prof is on"
options['profilingsupport'] = 'on'


def ParseEnvOverrides(arg, imports):
Expand Down
6 changes: 3 additions & 3 deletions deps/v8/include/v8.h
Original file line number Diff line number Diff line change
Expand Up @@ -2725,9 +2725,9 @@ class Internals {

// These constants are compiler dependent so their values must be
// defined within the implementation.
static int kJSObjectType;
static int kFirstNonstringType;
static int kProxyType;
V8EXPORT static int kJSObjectType;
V8EXPORT static int kFirstNonstringType;
V8EXPORT static int kProxyType;

static inline bool HasHeapObjectTag(internal::Object* value) {
return ((reinterpret_cast<intptr_t>(value) & kHeapObjectTagMask) ==
Expand Down
4 changes: 1 addition & 3 deletions deps/v8/src/api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2672,9 +2672,7 @@ Persistent<Context> v8::Context::New(
}
// Leave V8.

if (!ApiCheck(!env.is_null(),
"v8::Context::New()",
"Could not initialize environment"))
if (env.is_null())
return Persistent<Context>();
return Persistent<Context>(Utils::ToLocal(env));
}
Expand Down
29 changes: 17 additions & 12 deletions deps/v8/src/arm/assembler-arm-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,40 +105,45 @@ Address* RelocInfo::target_reference_address() {

Address RelocInfo::call_address() {
ASSERT(IsCallInstruction());
UNIMPLEMENTED();
return NULL;
// The 2 instructions offset assumes patched return sequence.
ASSERT(IsJSReturn(rmode()));
return Memory::Address_at(pc_ + 2 * Assembler::kInstrSize);
}


void RelocInfo::set_call_address(Address target) {
ASSERT(IsCallInstruction());
UNIMPLEMENTED();
// The 2 instructions offset assumes patched return sequence.
ASSERT(IsJSReturn(rmode()));
Memory::Address_at(pc_ + 2 * Assembler::kInstrSize) = target;
}


Object* RelocInfo::call_object() {
ASSERT(IsCallInstruction());
UNIMPLEMENTED();
return NULL;
return *call_object_address();
}


Object** RelocInfo::call_object_address() {
ASSERT(IsCallInstruction());
UNIMPLEMENTED();
return NULL;
// The 2 instructions offset assumes patched return sequence.
ASSERT(IsJSReturn(rmode()));
return reinterpret_cast<Object**>(pc_ + 2 * Assembler::kInstrSize);
}


void RelocInfo::set_call_object(Object* target) {
ASSERT(IsCallInstruction());
UNIMPLEMENTED();
*call_object_address() = target;
}


bool RelocInfo::IsCallInstruction() {
UNIMPLEMENTED();
return false;
// On ARM a "call instruction" is actually two instructions.
// mov lr, pc
// ldr pc, [pc, #XXX]
return (Assembler::instr_at(pc_) == kMovLrPc)
&& ((Assembler::instr_at(pc_ + Assembler::kInstrSize) & kLdrPCPattern)
== kLdrPCPattern);
}


Expand Down
33 changes: 28 additions & 5 deletions deps/v8/src/arm/assembler-arm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,14 @@ const int RelocInfo::kApplyMask = 0;

void RelocInfo::PatchCode(byte* instructions, int instruction_count) {
// Patch the code at the current address with the supplied instructions.
UNIMPLEMENTED();
Instr* pc = reinterpret_cast<Instr*>(pc_);
Instr* instr = reinterpret_cast<Instr*>(instructions);
for (int i = 0; i < instruction_count; i++) {
*(pc + i) = *(instr + i);
}

// Indicate that code has changed.
CPU::FlushICache(pc_, instruction_count * Assembler::kInstrSize);
}


Expand Down Expand Up @@ -232,6 +239,10 @@ static const Instr kPushRegPattern =
// register r is not encoded.
static const Instr kPopRegPattern =
al | B26 | L | 4 | PostIndex | sp.code() * B16;
// mov lr, pc
const Instr kMovLrPc = al | 13*B21 | pc.code() | lr.code() * B12;
// ldr pc, [pc, #XXX]
const Instr kLdrPCPattern = al | B26 | L | pc.code() * B16;

// spare_buffer_
static const int kMinimalBufferSize = 4*KB;
Expand Down Expand Up @@ -1301,6 +1312,13 @@ void Assembler::lea(Register dst,


// Debugging
void Assembler::RecordJSReturn() {
WriteRecordedPositions();
CheckBuffer();
RecordRelocInfo(RelocInfo::JS_RETURN);
}


void Assembler::RecordComment(const char* msg) {
if (FLAG_debug_code) {
CheckBuffer();
Expand Down Expand Up @@ -1387,16 +1405,20 @@ void Assembler::GrowBuffer() {
RelocInfo& rinfo = prinfo_[i];
ASSERT(rinfo.rmode() != RelocInfo::COMMENT &&
rinfo.rmode() != RelocInfo::POSITION);
rinfo.set_pc(rinfo.pc() + pc_delta);
if (rinfo.rmode() != RelocInfo::JS_RETURN) {
rinfo.set_pc(rinfo.pc() + pc_delta);
}
}
}


void Assembler::RecordRelocInfo(RelocInfo::Mode rmode, intptr_t data) {
RelocInfo rinfo(pc_, rmode, data); // we do not try to reuse pool constants
if (rmode >= RelocInfo::COMMENT && rmode <= RelocInfo::STATEMENT_POSITION) {
// adjust code for new modes
ASSERT(RelocInfo::IsComment(rmode) || RelocInfo::IsPosition(rmode));
if (rmode >= RelocInfo::JS_RETURN && rmode <= RelocInfo::STATEMENT_POSITION) {
// Adjust code for new modes
ASSERT(RelocInfo::IsJSReturn(rmode)
|| RelocInfo::IsComment(rmode)
|| RelocInfo::IsPosition(rmode));
// these modes do not need an entry in the constant pool
} else {
ASSERT(num_prinfo_ < kMaxNumPRInfo);
Expand Down Expand Up @@ -1490,6 +1512,7 @@ void Assembler::CheckConstPool(bool force_emit, bool require_jump) {
rinfo.rmode() != RelocInfo::POSITION &&
rinfo.rmode() != RelocInfo::STATEMENT_POSITION);
Instr instr = instr_at(rinfo.pc());

// Instruction to patch must be a ldr/str [pc, #offset]
// P and U set, B and W clear, Rn == pc, offset12 still 0
ASSERT((instr & (7*B25 | P | U | B | W | 15*B16 | Off12Mask)) ==
Expand Down
24 changes: 20 additions & 4 deletions deps/v8/src/arm/assembler-arm.h
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,10 @@ class MemOperand BASE_EMBEDDED {
typedef int32_t Instr;


extern const Instr kMovLrPc;
extern const Instr kLdrPCPattern;


class Assembler : public Malloced {
public:
// Create an assembler. Instructions and relocation information are emitted
Expand Down Expand Up @@ -433,12 +437,16 @@ class Assembler : public Malloced {
INLINE(static Address target_address_at(Address pc));
INLINE(static void set_target_address_at(Address pc, Address target));

// Size of an instruction.
static const int kInstrSize = sizeof(Instr);

// Distance between the instruction referring to the address of the call
// target (ldr pc, [target addr in const pool]) and the return address
static const int kPatchReturnSequenceLength = sizeof(Instr);
static const int kCallTargetAddressOffset = kInstrSize;

// Distance between start of patched return sequence and the emitted address
// to jump to.
static const int kPatchReturnSequenceAddressOffset = 1;
static const int kPatchReturnSequenceAddressOffset = kInstrSize;

// Difference between address of current opcode and value read from pc
// register.
Expand Down Expand Up @@ -652,9 +660,16 @@ class Assembler : public Malloced {
// Jump unconditionally to given label.
void jmp(Label* L) { b(L, al); }

// Check the code size generated from label to here.
int InstructionsGeneratedSince(Label* l) {
return (pc_offset() - l->pos()) / kInstrSize;
}

// Debugging

// Mark address of the ExitJSFrame code.
void RecordJSReturn();

// Record a comment relocation entry that can be used by a disassembler.
// Use --debug_code to enable.
void RecordComment(const char* msg);
Expand All @@ -671,7 +686,7 @@ class Assembler : public Malloced {
int buffer_space() const { return reloc_info_writer.pos() - pc_; }

// Read/patch instructions
Instr instr_at(byte* pc) { return *reinterpret_cast<Instr*>(pc); }
static Instr instr_at(byte* pc) { return *reinterpret_cast<Instr*>(pc); }
void instr_at_put(byte* pc, Instr instr) {
*reinterpret_cast<Instr*>(pc) = instr;
}
Expand Down Expand Up @@ -708,7 +723,6 @@ class Assembler : public Malloced {
int next_buffer_check_; // pc offset of next buffer check

// Code generation
static const int kInstrSize = sizeof(Instr); // signed size
// The relocation writer's position is at least kGap bytes below the end of
// the generated instructions. This is so that multi-instruction sequences do
// not have to check for overflow. The same is true for writes of large
Expand Down Expand Up @@ -795,6 +809,8 @@ class Assembler : public Malloced {
void RecordRelocInfo(RelocInfo::Mode rmode, intptr_t data = 0);

friend class RegExpMacroAssemblerARM;
friend class RelocInfo;
friend class CodePatcher;
};

} } // namespace v8::internal
Expand Down
Loading

0 comments on commit ab530bb

Please sign in to comment.