Skip to content

Commit ab530bb

Browse files
committed
Upgrade v8 to 1.3.11
1 parent 605b7e9 commit ab530bb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+1881
-828
lines changed

deps/v8/ChangeLog

+13
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
2009-09-15: Version 1.3.11
2+
3+
Fixed crash in error reporting during bootstrapping.
4+
5+
Optimized generated IA32 math code by using SSE2 instructions when
6+
available.
7+
8+
Implemented missing pieces of debugger infrastructure on ARM. The
9+
debugger is now fully functional on ARM.
10+
11+
Make 'hidden' the default visibility for gcc.
12+
13+
114
2009-09-09: Version 1.3.10
215

316
Fixed profiler on Mac in 64-bit mode.

deps/v8/SConstruct

+30-4
Original file line numberDiff line numberDiff line change
@@ -96,25 +96,33 @@ ANDROID_LINKFLAGS = ['-nostdlib',
9696

9797
LIBRARY_FLAGS = {
9898
'all': {
99-
'CPPDEFINES': ['ENABLE_LOGGING_AND_PROFILING'],
10099
'CPPPATH': [join(root_dir, 'src')],
101100
'regexp:native': {
102101
'CPPDEFINES': ['V8_NATIVE_REGEXP']
103102
},
104103
'mode:debug': {
105104
'CPPDEFINES': ['V8_ENABLE_CHECKS']
105+
},
106+
'profilingsupport:on': {
107+
'CPPDEFINES': ['ENABLE_LOGGING_AND_PROFILING'],
108+
},
109+
'debuggersupport:on': {
110+
'CPPDEFINES': ['ENABLE_DEBUGGER_SUPPORT'],
106111
}
107112
},
108113
'gcc': {
109114
'all': {
110115
'CCFLAGS': ['$DIALECTFLAGS', '$WARNINGFLAGS'],
111116
'CXXFLAGS': ['$CCFLAGS', '-fno-rtti', '-fno-exceptions'],
112117
},
118+
'visibility:hidden': {
119+
# Use visibility=default to disable this.
120+
'CXXFLAGS': ['-fvisibility=hidden']
121+
},
113122
'mode:debug': {
114123
'CCFLAGS': ['-g', '-O0'],
115124
'CPPDEFINES': ['ENABLE_DISASSEMBLER', 'DEBUG'],
116125
'os:android': {
117-
'CPPDEFINES': ['ENABLE_DEBUGGER_SUPPORT'],
118126
'CCFLAGS': ['-mthumb']
119127
}
120128
},
@@ -123,7 +131,7 @@ LIBRARY_FLAGS = {
123131
'-ffunction-sections'],
124132
'os:android': {
125133
'CCFLAGS': ['-mthumb', '-Os'],
126-
'CPPDEFINES': ['SK_RELEASE', 'NDEBUG', 'ENABLE_DEBUGGER_SUPPORT']
134+
'CPPDEFINES': ['SK_RELEASE', 'NDEBUG']
127135
}
128136
},
129137
'os:linux': {
@@ -229,7 +237,6 @@ LIBRARY_FLAGS = {
229237
V8_EXTRA_FLAGS = {
230238
'gcc': {
231239
'all': {
232-
'CXXFLAGS': [], #['-fvisibility=hidden'],
233240
'WARNINGFLAGS': ['-Wall',
234241
'-Werror',
235242
'-W',
@@ -576,6 +583,16 @@ SIMPLE_OPTIONS = {
576583
'default': 'static',
577584
'help': 'the type of library to produce'
578585
},
586+
'profilingsupport': {
587+
'values': ['on', 'off'],
588+
'default': 'on',
589+
'help': 'enable profiling of JavaScript code'
590+
},
591+
'debuggersupport': {
592+
'values': ['on', 'off'],
593+
'default': 'on',
594+
'help': 'enable debugging of JavaScript code'
595+
},
579596
'soname': {
580597
'values': ['on', 'off'],
581598
'default': 'off',
@@ -615,6 +632,11 @@ SIMPLE_OPTIONS = {
615632
'values': ['on', 'off'],
616633
'default': 'off',
617634
'help': 'more output from compiler and linker'
635+
},
636+
'visibility': {
637+
'values': ['default', 'hidden'],
638+
'default': 'hidden',
639+
'help': 'shared library symbol visibility'
618640
}
619641
}
620642

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

798824

799825
def ParseEnvOverrides(arg, imports):

deps/v8/include/v8.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -2725,9 +2725,9 @@ class Internals {
27252725

27262726
// These constants are compiler dependent so their values must be
27272727
// defined within the implementation.
2728-
static int kJSObjectType;
2729-
static int kFirstNonstringType;
2730-
static int kProxyType;
2728+
V8EXPORT static int kJSObjectType;
2729+
V8EXPORT static int kFirstNonstringType;
2730+
V8EXPORT static int kProxyType;
27312731

27322732
static inline bool HasHeapObjectTag(internal::Object* value) {
27332733
return ((reinterpret_cast<intptr_t>(value) & kHeapObjectTagMask) ==

deps/v8/src/api.cc

+1-3
Original file line numberDiff line numberDiff line change
@@ -2672,9 +2672,7 @@ Persistent<Context> v8::Context::New(
26722672
}
26732673
// Leave V8.
26742674

2675-
if (!ApiCheck(!env.is_null(),
2676-
"v8::Context::New()",
2677-
"Could not initialize environment"))
2675+
if (env.is_null())
26782676
return Persistent<Context>();
26792677
return Persistent<Context>(Utils::ToLocal(env));
26802678
}

deps/v8/src/arm/assembler-arm-inl.h

+17-12
Original file line numberDiff line numberDiff line change
@@ -105,40 +105,45 @@ Address* RelocInfo::target_reference_address() {
105105

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

112113

113114
void RelocInfo::set_call_address(Address target) {
114115
ASSERT(IsCallInstruction());
115-
UNIMPLEMENTED();
116+
// The 2 instructions offset assumes patched return sequence.
117+
ASSERT(IsJSReturn(rmode()));
118+
Memory::Address_at(pc_ + 2 * Assembler::kInstrSize) = target;
116119
}
117120

118121

119122
Object* RelocInfo::call_object() {
120-
ASSERT(IsCallInstruction());
121-
UNIMPLEMENTED();
122-
return NULL;
123+
return *call_object_address();
123124
}
124125

125126

126127
Object** RelocInfo::call_object_address() {
127128
ASSERT(IsCallInstruction());
128-
UNIMPLEMENTED();
129-
return NULL;
129+
// The 2 instructions offset assumes patched return sequence.
130+
ASSERT(IsJSReturn(rmode()));
131+
return reinterpret_cast<Object**>(pc_ + 2 * Assembler::kInstrSize);
130132
}
131133

132134

133135
void RelocInfo::set_call_object(Object* target) {
134-
ASSERT(IsCallInstruction());
135-
UNIMPLEMENTED();
136+
*call_object_address() = target;
136137
}
137138

138139

139140
bool RelocInfo::IsCallInstruction() {
140-
UNIMPLEMENTED();
141-
return false;
141+
// On ARM a "call instruction" is actually two instructions.
142+
// mov lr, pc
143+
// ldr pc, [pc, #XXX]
144+
return (Assembler::instr_at(pc_) == kMovLrPc)
145+
&& ((Assembler::instr_at(pc_ + Assembler::kInstrSize) & kLdrPCPattern)
146+
== kLdrPCPattern);
142147
}
143148

144149

deps/v8/src/arm/assembler-arm.cc

+28-5
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,14 @@ const int RelocInfo::kApplyMask = 0;
9393

9494
void RelocInfo::PatchCode(byte* instructions, int instruction_count) {
9595
// Patch the code at the current address with the supplied instructions.
96-
UNIMPLEMENTED();
96+
Instr* pc = reinterpret_cast<Instr*>(pc_);
97+
Instr* instr = reinterpret_cast<Instr*>(instructions);
98+
for (int i = 0; i < instruction_count; i++) {
99+
*(pc + i) = *(instr + i);
100+
}
101+
102+
// Indicate that code has changed.
103+
CPU::FlushICache(pc_, instruction_count * Assembler::kInstrSize);
97104
}
98105

99106

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

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

13021313

13031314
// Debugging
1315+
void Assembler::RecordJSReturn() {
1316+
WriteRecordedPositions();
1317+
CheckBuffer();
1318+
RecordRelocInfo(RelocInfo::JS_RETURN);
1319+
}
1320+
1321+
13041322
void Assembler::RecordComment(const char* msg) {
13051323
if (FLAG_debug_code) {
13061324
CheckBuffer();
@@ -1387,16 +1405,20 @@ void Assembler::GrowBuffer() {
13871405
RelocInfo& rinfo = prinfo_[i];
13881406
ASSERT(rinfo.rmode() != RelocInfo::COMMENT &&
13891407
rinfo.rmode() != RelocInfo::POSITION);
1390-
rinfo.set_pc(rinfo.pc() + pc_delta);
1408+
if (rinfo.rmode() != RelocInfo::JS_RETURN) {
1409+
rinfo.set_pc(rinfo.pc() + pc_delta);
1410+
}
13911411
}
13921412
}
13931413

13941414

13951415
void Assembler::RecordRelocInfo(RelocInfo::Mode rmode, intptr_t data) {
13961416
RelocInfo rinfo(pc_, rmode, data); // we do not try to reuse pool constants
1397-
if (rmode >= RelocInfo::COMMENT && rmode <= RelocInfo::STATEMENT_POSITION) {
1398-
// adjust code for new modes
1399-
ASSERT(RelocInfo::IsComment(rmode) || RelocInfo::IsPosition(rmode));
1417+
if (rmode >= RelocInfo::JS_RETURN && rmode <= RelocInfo::STATEMENT_POSITION) {
1418+
// Adjust code for new modes
1419+
ASSERT(RelocInfo::IsJSReturn(rmode)
1420+
|| RelocInfo::IsComment(rmode)
1421+
|| RelocInfo::IsPosition(rmode));
14001422
// these modes do not need an entry in the constant pool
14011423
} else {
14021424
ASSERT(num_prinfo_ < kMaxNumPRInfo);
@@ -1490,6 +1512,7 @@ void Assembler::CheckConstPool(bool force_emit, bool require_jump) {
14901512
rinfo.rmode() != RelocInfo::POSITION &&
14911513
rinfo.rmode() != RelocInfo::STATEMENT_POSITION);
14921514
Instr instr = instr_at(rinfo.pc());
1515+
14931516
// Instruction to patch must be a ldr/str [pc, #offset]
14941517
// P and U set, B and W clear, Rn == pc, offset12 still 0
14951518
ASSERT((instr & (7*B25 | P | U | B | W | 15*B16 | Off12Mask)) ==

deps/v8/src/arm/assembler-arm.h

+20-4
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,10 @@ class MemOperand BASE_EMBEDDED {
376376
typedef int32_t Instr;
377377

378378

379+
extern const Instr kMovLrPc;
380+
extern const Instr kLdrPCPattern;
381+
382+
379383
class Assembler : public Malloced {
380384
public:
381385
// Create an assembler. Instructions and relocation information are emitted
@@ -433,12 +437,16 @@ class Assembler : public Malloced {
433437
INLINE(static Address target_address_at(Address pc));
434438
INLINE(static void set_target_address_at(Address pc, Address target));
435439

440+
// Size of an instruction.
441+
static const int kInstrSize = sizeof(Instr);
442+
436443
// Distance between the instruction referring to the address of the call
437444
// target (ldr pc, [target addr in const pool]) and the return address
438-
static const int kPatchReturnSequenceLength = sizeof(Instr);
445+
static const int kCallTargetAddressOffset = kInstrSize;
446+
439447
// Distance between start of patched return sequence and the emitted address
440448
// to jump to.
441-
static const int kPatchReturnSequenceAddressOffset = 1;
449+
static const int kPatchReturnSequenceAddressOffset = kInstrSize;
442450

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

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

656668
// Debugging
657669

670+
// Mark address of the ExitJSFrame code.
671+
void RecordJSReturn();
672+
658673
// Record a comment relocation entry that can be used by a disassembler.
659674
// Use --debug_code to enable.
660675
void RecordComment(const char* msg);
@@ -671,7 +686,7 @@ class Assembler : public Malloced {
671686
int buffer_space() const { return reloc_info_writer.pos() - pc_; }
672687

673688
// Read/patch instructions
674-
Instr instr_at(byte* pc) { return *reinterpret_cast<Instr*>(pc); }
689+
static Instr instr_at(byte* pc) { return *reinterpret_cast<Instr*>(pc); }
675690
void instr_at_put(byte* pc, Instr instr) {
676691
*reinterpret_cast<Instr*>(pc) = instr;
677692
}
@@ -708,7 +723,6 @@ class Assembler : public Malloced {
708723
int next_buffer_check_; // pc offset of next buffer check
709724

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

797811
friend class RegExpMacroAssemblerARM;
812+
friend class RelocInfo;
813+
friend class CodePatcher;
798814
};
799815

800816
} } // namespace v8::internal

0 commit comments

Comments
 (0)