Skip to content

Commit c8b6ef2

Browse files
committed
upgrade v8 to 2.0.3
1 parent c5d8238 commit c8b6ef2

99 files changed

Lines changed: 4250 additions & 1460 deletions

Some content is hidden

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

deps/v8/ChangeLog

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,26 @@
1+
2009-12-03: Version 2.0.3
2+
3+
Optimized handling and adding of strings, for-in and Array.join.
4+
5+
Heap serialization is now non-destructive.
6+
7+
Improved profiler support with information on time spend in C++
8+
callbacks registered through the API.
9+
10+
Added commands to the debugger protocol for starting/stopping
11+
profiling.
12+
13+
Enabled the non-optimizing compiler for top-level code.
14+
15+
Changed the API to only allow strings to be set as data objects on
16+
Contexts and scripts to avoid potentially keeping global objects
17+
around for too long (issue 528).
18+
19+
OpenBSD support patch by Peter Valchev <pvalchev@gmail.com>.
20+
21+
Fixed bugs.
22+
23+
124
2009-11-24: Version 2.0.2
225

326
Improved profiler support.
@@ -34,7 +57,7 @@
3457

3558
Reverted a change which caused crashes in RegExp replace.
3659

37-
Reverted a change which caused Chromium ui_tests failure.
60+
Reverted a change which caused Chromium ui_tests failure.
3861

3962

4063
2009-10-28: Version 1.3.17

deps/v8/SConstruct

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,11 @@ LIBRARY_FLAGS = {
149149
'LIBPATH' : ['/usr/local/lib'],
150150
'CCFLAGS': ['-ansi'],
151151
},
152+
'os:openbsd': {
153+
'CPPPATH' : ['/usr/local/include'],
154+
'LIBPATH' : ['/usr/local/lib'],
155+
'CCFLAGS': ['-ansi'],
156+
},
152157
'os:win32': {
153158
'CCFLAGS': ['-DWIN32'],
154159
'CXXFLAGS': ['-DWIN32'],
@@ -298,6 +303,9 @@ MKSNAPSHOT_EXTRA_FLAGS = {
298303
'os:freebsd': {
299304
'LIBS': ['execinfo', 'pthread']
300305
},
306+
'os:openbsd': {
307+
'LIBS': ['execinfo', 'pthread']
308+
},
301309
'os:win32': {
302310
'LIBS': ['winmm', 'ws2_32'],
303311
},
@@ -344,6 +352,9 @@ CCTEST_EXTRA_FLAGS = {
344352
'os:freebsd': {
345353
'LIBS': ['execinfo', 'pthread']
346354
},
355+
'os:openbsd': {
356+
'LIBS': ['execinfo', 'pthread']
357+
},
347358
'os:win32': {
348359
'LIBS': ['winmm', 'ws2_32']
349360
},
@@ -397,7 +408,11 @@ SAMPLE_FLAGS = {
397408
},
398409
'os:freebsd': {
399410
'LIBPATH' : ['/usr/local/lib'],
400-
'LIBS': ['execinfo', 'pthread']
411+
'LIBS': ['execinfo', 'pthread']
412+
},
413+
'os:openbsd': {
414+
'LIBPATH' : ['/usr/local/lib'],
415+
'LIBS': ['execinfo', 'pthread']
401416
},
402417
'os:win32': {
403418
'LIBS': ['winmm', 'ws2_32']
@@ -504,6 +519,9 @@ D8_FLAGS = {
504519
'os:freebsd': {
505520
'LIBS': ['pthread'],
506521
},
522+
'os:openbsd': {
523+
'LIBS': ['pthread'],
524+
},
507525
'os:android': {
508526
'LIBPATH': [ANDROID_TOP + '/out/target/product/generic/obj/lib'],
509527
'LINKFLAGS': ANDROID_LINKFLAGS,
@@ -544,7 +562,7 @@ def GuessToolchain(os):
544562

545563
OS_GUESS = utils.GuessOS()
546564
TOOLCHAIN_GUESS = GuessToolchain(OS_GUESS)
547-
ARCH_GUESS = utils.GuessArchitecture() or ""
565+
ARCH_GUESS = utils.GuessArchitecture()
548566

549567

550568
SIMPLE_OPTIONS = {
@@ -554,7 +572,7 @@ SIMPLE_OPTIONS = {
554572
'help': 'the toolchain to use (' + TOOLCHAIN_GUESS + ')'
555573
},
556574
'os': {
557-
'values': ['freebsd', 'linux', 'macos', 'win32', 'android'],
575+
'values': ['freebsd', 'linux', 'macos', 'win32', 'android', 'openbsd'],
558576
'default': OS_GUESS,
559577
'help': 'the os to build for (' + OS_GUESS + ')'
560578
},

deps/v8/include/v8.h

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,7 @@ class V8EXPORT Script {
598598
* with the debugger as this data object is only available through the
599599
* debugger API.
600600
*/
601-
void SetData(Handle<Value> data);
601+
void SetData(Handle<String> data);
602602
};
603603

604604

@@ -2634,7 +2634,7 @@ class V8EXPORT Context {
26342634
* with the debugger to provide additional information on the context through
26352635
* the debugger API.
26362636
*/
2637-
void SetData(Handle<Value> data);
2637+
void SetData(Handle<String> data);
26382638
Local<Value> GetData();
26392639

26402640
/**
@@ -2819,6 +2819,18 @@ template <> struct SmiConstants<8> {
28192819
const int kSmiShiftSize = SmiConstants<sizeof(void*)>::kSmiShiftSize;
28202820
const int kSmiValueSize = SmiConstants<sizeof(void*)>::kSmiValueSize;
28212821

2822+
template <size_t ptr_size> struct InternalConstants;
2823+
2824+
// Internal constants for 32-bit systems.
2825+
template <> struct InternalConstants<4> {
2826+
static const int kStringResourceOffset = 3 * sizeof(void*);
2827+
};
2828+
2829+
// Internal constants for 64-bit systems.
2830+
template <> struct InternalConstants<8> {
2831+
static const int kStringResourceOffset = 2 * sizeof(void*);
2832+
};
2833+
28222834
/**
28232835
* This class exports constants and functionality from within v8 that
28242836
* is necessary to implement inline functions in the v8 api. Don't
@@ -2831,7 +2843,9 @@ class Internals {
28312843
// the implementation of v8.
28322844
static const int kHeapObjectMapOffset = 0;
28332845
static const int kMapInstanceTypeOffset = sizeof(void*) + sizeof(int);
2834-
static const int kStringResourceOffset = 2 * sizeof(void*);
2846+
static const int kStringResourceOffset =
2847+
InternalConstants<sizeof(void*)>::kStringResourceOffset;
2848+
28352849
static const int kProxyProxyOffset = sizeof(void*);
28362850
static const int kJSObjectHeaderSize = 3 * sizeof(void*);
28372851
static const int kFullStringRepresentationMask = 0x07;

deps/v8/src/SConscript

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ SOURCES = {
159159
"""),
160160
'simulator:arm': ['arm/simulator-arm.cc'],
161161
'os:freebsd': ['platform-freebsd.cc', 'platform-posix.cc'],
162+
'os:openbsd': ['platform-openbsd.cc', 'platform-posix.cc'],
162163
'os:linux': ['platform-linux.cc', 'platform-posix.cc'],
163164
'os:android': ['platform-linux.cc', 'platform-posix.cc'],
164165
'os:macos': ['platform-macos.cc', 'platform-posix.cc'],
@@ -187,6 +188,9 @@ D8_FILES = {
187188
'os:freebsd': [
188189
'd8-posix.cc'
189190
],
191+
'os:openbsd': [
192+
'd8-posix.cc'
193+
],
190194
'os:win32': [
191195
'd8-windows.cc'
192196
],

deps/v8/src/accessors.cc

Lines changed: 52 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -315,14 +315,11 @@ Object* Accessors::ScriptGetLineEnds(Object* object, void*) {
315315
HandleScope scope;
316316
Handle<Script> script(Script::cast(JSValue::cast(object)->value()));
317317
InitScriptLineEnds(script);
318-
if (script->line_ends_js_array()->IsUndefined()) {
319-
Handle<FixedArray> line_ends_fixed_array(
320-
FixedArray::cast(script->line_ends_fixed_array()));
321-
Handle<FixedArray> copy = Factory::CopyFixedArray(line_ends_fixed_array);
322-
Handle<JSArray> js_array = Factory::NewJSArrayWithElements(copy);
323-
script->set_line_ends_js_array(*js_array);
324-
}
325-
return script->line_ends_js_array();
318+
ASSERT(script->line_ends()->IsFixedArray());
319+
Handle<FixedArray> line_ends(FixedArray::cast(script->line_ends()));
320+
Handle<FixedArray> copy = Factory::CopyFixedArray(line_ends);
321+
Handle<JSArray> js_array = Factory::NewJSArrayWithElements(copy);
322+
return *js_array;
326323
}
327324

328325

@@ -352,29 +349,38 @@ const AccessorDescriptor Accessors::ScriptContextData = {
352349

353350

354351
//
355-
// Accessors::ScriptGetEvalFromFunction
352+
// Accessors::ScriptGetEvalFromScript
356353
//
357354

358355

359-
Object* Accessors::ScriptGetEvalFromFunction(Object* object, void*) {
356+
Object* Accessors::ScriptGetEvalFromScript(Object* object, void*) {
360357
Object* script = JSValue::cast(object)->value();
361-
return Script::cast(script)->eval_from_function();
358+
if (!Script::cast(script)->eval_from_shared()->IsUndefined()) {
359+
Handle<SharedFunctionInfo> eval_from_shared(
360+
SharedFunctionInfo::cast(Script::cast(script)->eval_from_shared()));
361+
362+
if (eval_from_shared->script()->IsScript()) {
363+
Handle<Script> eval_from_script(Script::cast(eval_from_shared->script()));
364+
return *GetScriptWrapper(eval_from_script);
365+
}
366+
}
367+
return Heap::undefined_value();
362368
}
363369

364370

365-
const AccessorDescriptor Accessors::ScriptEvalFromFunction = {
366-
ScriptGetEvalFromFunction,
371+
const AccessorDescriptor Accessors::ScriptEvalFromScript = {
372+
ScriptGetEvalFromScript,
367373
IllegalSetter,
368374
0
369375
};
370376

371377

372378
//
373-
// Accessors::ScriptGetEvalFromPosition
379+
// Accessors::ScriptGetEvalFromScriptPosition
374380
//
375381

376382

377-
Object* Accessors::ScriptGetEvalFromPosition(Object* object, void*) {
383+
Object* Accessors::ScriptGetEvalFromScriptPosition(Object* object, void*) {
378384
HandleScope scope;
379385
Handle<Script> script(Script::cast(JSValue::cast(object)->value()));
380386

@@ -386,14 +392,42 @@ Object* Accessors::ScriptGetEvalFromPosition(Object* object, void*) {
386392

387393
// Get the function from where eval was called and find the source position
388394
// from the instruction offset.
389-
Handle<Code> code(JSFunction::cast(script->eval_from_function())->code());
395+
Handle<Code> code(SharedFunctionInfo::cast(
396+
script->eval_from_shared())->code());
390397
return Smi::FromInt(code->SourcePosition(code->instruction_start() +
391398
script->eval_from_instructions_offset()->value()));
392399
}
393400

394401

395-
const AccessorDescriptor Accessors::ScriptEvalFromPosition = {
396-
ScriptGetEvalFromPosition,
402+
const AccessorDescriptor Accessors::ScriptEvalFromScriptPosition = {
403+
ScriptGetEvalFromScriptPosition,
404+
IllegalSetter,
405+
0
406+
};
407+
408+
409+
//
410+
// Accessors::ScriptGetEvalFromFunctionName
411+
//
412+
413+
414+
Object* Accessors::ScriptGetEvalFromFunctionName(Object* object, void*) {
415+
Object* script = JSValue::cast(object)->value();
416+
Handle<SharedFunctionInfo> shared(SharedFunctionInfo::cast(
417+
Script::cast(script)->eval_from_shared()));
418+
419+
420+
// Find the name of the function calling eval.
421+
if (!shared->name()->IsUndefined()) {
422+
return shared->name();
423+
} else {
424+
return shared->inferred_name();
425+
}
426+
}
427+
428+
429+
const AccessorDescriptor Accessors::ScriptEvalFromFunctionName = {
430+
ScriptGetEvalFromFunctionName,
397431
IllegalSetter,
398432
0
399433
};

deps/v8/src/accessors.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,9 @@ namespace internal {
5151
V(ScriptCompilationType) \
5252
V(ScriptLineEnds) \
5353
V(ScriptContextData) \
54-
V(ScriptEvalFromFunction) \
55-
V(ScriptEvalFromPosition) \
54+
V(ScriptEvalFromScript) \
55+
V(ScriptEvalFromScriptPosition) \
56+
V(ScriptEvalFromFunctionName) \
5657
V(ObjectPrototype)
5758

5859
// Accessors contains all predefined proxy accessors.
@@ -95,8 +96,9 @@ class Accessors : public AllStatic {
9596
static Object* ScriptGetCompilationType(Object* object, void*);
9697
static Object* ScriptGetLineEnds(Object* object, void*);
9798
static Object* ScriptGetContextData(Object* object, void*);
98-
static Object* ScriptGetEvalFromFunction(Object* object, void*);
99-
static Object* ScriptGetEvalFromPosition(Object* object, void*);
99+
static Object* ScriptGetEvalFromScript(Object* object, void*);
100+
static Object* ScriptGetEvalFromScriptPosition(Object* object, void*);
101+
static Object* ScriptGetEvalFromFunctionName(Object* object, void*);
100102
static Object* ObjectGetPrototype(Object* receiver, void*);
101103
static Object* ObjectSetPrototype(JSObject* receiver, Object* value, void*);
102104

deps/v8/src/api.cc

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,48 @@ static FatalErrorCallback& GetFatalErrorHandler() {
126126
// When V8 cannot allocated memory FatalProcessOutOfMemory is called.
127127
// The default fatal error handler is called and execution is stopped.
128128
void i::V8::FatalProcessOutOfMemory(const char* location) {
129+
i::HeapStats heap_stats;
130+
int start_marker;
131+
heap_stats.start_marker = &start_marker;
132+
int new_space_size;
133+
heap_stats.new_space_size = &new_space_size;
134+
int new_space_capacity;
135+
heap_stats.new_space_capacity = &new_space_capacity;
136+
int old_pointer_space_size;
137+
heap_stats.old_pointer_space_size = &old_pointer_space_size;
138+
int old_pointer_space_capacity;
139+
heap_stats.old_pointer_space_capacity = &old_pointer_space_capacity;
140+
int old_data_space_size;
141+
heap_stats.old_data_space_size = &old_data_space_size;
142+
int old_data_space_capacity;
143+
heap_stats.old_data_space_capacity = &old_data_space_capacity;
144+
int code_space_size;
145+
heap_stats.code_space_size = &code_space_size;
146+
int code_space_capacity;
147+
heap_stats.code_space_capacity = &code_space_capacity;
148+
int map_space_size;
149+
heap_stats.map_space_size = &map_space_size;
150+
int map_space_capacity;
151+
heap_stats.map_space_capacity = &map_space_capacity;
152+
int cell_space_size;
153+
heap_stats.cell_space_size = &cell_space_size;
154+
int cell_space_capacity;
155+
heap_stats.cell_space_capacity = &cell_space_capacity;
156+
int lo_space_size;
157+
heap_stats.lo_space_size = &lo_space_size;
158+
int global_handle_count;
159+
heap_stats.global_handle_count = &global_handle_count;
160+
int weak_global_handle_count;
161+
heap_stats.weak_global_handle_count = &weak_global_handle_count;
162+
int pending_global_handle_count;
163+
heap_stats.pending_global_handle_count = &pending_global_handle_count;
164+
int near_death_global_handle_count;
165+
heap_stats.near_death_global_handle_count = &near_death_global_handle_count;
166+
int destroyed_global_handle_count;
167+
heap_stats.destroyed_global_handle_count = &destroyed_global_handle_count;
168+
int end_marker;
169+
heap_stats.end_marker = &end_marker;
170+
i::Heap::RecordStats(&heap_stats);
129171
i::V8::SetFatalError();
130172
FatalErrorCallback callback = GetFatalErrorHandler();
131173
{
@@ -451,7 +493,7 @@ void Context::Exit() {
451493
}
452494

453495

454-
void Context::SetData(v8::Handle<Value> data) {
496+
void Context::SetData(v8::Handle<String> data) {
455497
if (IsDeadCheck("v8::Context::SetData()")) return;
456498
ENTER_V8;
457499
{
@@ -1175,7 +1217,7 @@ Local<Value> Script::Id() {
11751217
}
11761218

11771219

1178-
void Script::SetData(v8::Handle<Value> data) {
1220+
void Script::SetData(v8::Handle<String> data) {
11791221
ON_BAILOUT("v8::Script::SetData()", return);
11801222
LOG_API("Script::SetData");
11811223
{

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -566,6 +566,7 @@ class Assembler : public Malloced {
566566
// register.
567567
static const int kPcLoadDelta = 8;
568568

569+
static const int kJSReturnSequenceLength = 4;
569570

570571
// ---------------------------------------------------------------------------
571572
// Code generation

0 commit comments

Comments
 (0)