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

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: We still generated the arrays with feature flag off. Fixed. 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
« no previous file with comments | « src/arm/lithium-codegen-arm.cc ('k') | src/builtins.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/bootstrapper.cc
diff --git a/src/bootstrapper.cc b/src/bootstrapper.cc
index 12f0cdac6b7faef80bc5f2d8299560696f315a47..860c96b90571e26820952c05f54e21e7739bb17e 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::kCommonArrayConstructCode));
+ }
}
{ // --- 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::kCommonArrayConstructCode));
array_function->shared()->DontAdaptArguments();
« no previous file with comments | « src/arm/lithium-codegen-arm.cc ('k') | src/builtins.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698