Chromium Code Reviews| Index: src/bootstrapper.cc |
| diff --git a/src/bootstrapper.cc b/src/bootstrapper.cc |
| index 12f0cdac6b7faef80bc5f2d8299560696f315a47..e54e32a724c1be0999bf28c105a91d116736dd6c 100644 |
| --- a/src/bootstrapper.cc |
| +++ b/src/bootstrapper.cc |
| @@ -43,6 +43,7 @@ |
| #include "extensions/externalize-string-extension.h" |
| #include "extensions/gc-extension.h" |
| #include "extensions/statistics-extension.h" |
| +#include "code-stubs.h" |
| namespace v8 { |
| namespace internal { |
| @@ -862,8 +863,6 @@ bool Genesis::InitializeGlobal(Handle<GlobalObject> inner_global, |
| InstallFunction(global, "Array", JS_ARRAY_TYPE, JSArray::kSize, |
| isolate->initial_object_prototype(), |
| Builtins::kArrayCode, true); |
| - array_function->shared()->set_construct_stub( |
| - isolate->builtins()->builtin(Builtins::kArrayConstructCode)); |
| array_function->shared()->DontAdaptArguments(); |
| // This seems a bit hackish, but we need to make sure Array.length |
| @@ -890,6 +889,20 @@ bool Genesis::InitializeGlobal(Handle<GlobalObject> inner_global, |
| // as the constructor. 'Array' property on a global object can be |
| // overwritten by JS code. |
| native_context()->set_array_function(*array_function); |
| + |
| + // Cache the array maps |
| + MaybeObject* cache_result = CacheInitialJSArrayMaps(*native_context(), |
| + *initial_map); |
| + if (cache_result->IsFailure()) return false; |
| + |
| + if (FLAG_optimize_constructed_arrays) { |
| + ArrayConstructorStub array_constructor_stub(isolate); |
| + array_function->shared()->set_construct_stub( |
| + *array_constructor_stub.GetCode(isolate)); |
| + } else { |
| + array_function->shared()->set_construct_stub( |
| + isolate->builtins()->builtin(Builtins::kInternalArrayConstructCode)); |
|
mvstanton
2013/04/18 14:43:01
wrong builtin.
mvstanton
2013/04/23 14:19:57
Actually it's not wrong, it's just confusingly nam
|
| + } |
| } |
| { // --- N u m b e r --- |
| @@ -1533,13 +1546,8 @@ Handle<JSFunction> Genesis::InstallInternalArray( |
| factory()->NewJSObject(isolate()->object_function(), TENURED); |
| SetPrototype(array_function, prototype); |
| - // TODO(mvstanton): For performance reasons, this code would have to |
| - // be changed to successfully run with FLAG_optimize_constructed_arrays. |
| - // The next checkin to enable FLAG_optimize_constructed_arrays by |
| - // default will address this. |
| - CHECK(!FLAG_optimize_constructed_arrays); |
| array_function->shared()->set_construct_stub( |
| - isolate()->builtins()->builtin(Builtins::kArrayConstructCode)); |
| + isolate()->builtins()->builtin(Builtins::kInternalArrayConstructCode)); |
| array_function->shared()->DontAdaptArguments(); |