Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1013)

Unified Diff: src/bootstrapper.cc

Issue 12385014: Hydrogen stubs for array constructors (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: With all ports done Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/bootstrapper.cc
diff --git a/src/bootstrapper.cc b/src/bootstrapper.cc
index df984483f9920265f03fe0f7bed837a0ce6297b5..30331f002c77190da1e34e5dda91b77625a0112f 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 {
@@ -860,8 +861,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
@@ -888,6 +887,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));
+ }
}
{ // --- N u m b e r ---
@@ -1512,13 +1525,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();

Powered by Google App Engine
This is Rietveld 408576698