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

Unified Diff: src/stub-cache.cc

Issue 7044083: Refactor platform-specific code for determining shared stub for keyed load/stores. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 6 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/stub-cache.h ('k') | src/x64/stub-cache-x64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/stub-cache.cc
diff --git a/src/stub-cache.cc b/src/stub-cache.cc
index 7bbb333f1156011f9f84f788a0722e7401f477f0..33c87a36001d2b3e5aeb3e95ba060b961fa53998 100644
--- a/src/stub-cache.cc
+++ b/src/stub-cache.cc
@@ -29,6 +29,7 @@
#include "api.h"
#include "arguments.h"
+#include "code-stubs.h"
#include "gdb-jit.h"
#include "ic-inl.h"
#include "stub-cache.h"
@@ -502,12 +503,13 @@ MaybeObject* StubCache::ComputeKeyedLoadOrStoreElement(
if (!maybe_code->IsUndefined()) return Code::cast(maybe_code);
MaybeObject* maybe_new_code = NULL;
+ Map* receiver_map = receiver->map();
if (is_store) {
KeyedStoreStubCompiler compiler(strict_mode);
- maybe_new_code = compiler.CompileStoreElement(receiver->map());
+ maybe_new_code = compiler.CompileStoreElement(receiver_map);
} else {
KeyedLoadStubCompiler compiler;
- maybe_new_code = compiler.CompileLoadElement(receiver->map());
+ maybe_new_code = compiler.CompileLoadElement(receiver_map);
}
Code* code;
if (!maybe_new_code->To(&code)) return maybe_new_code;
@@ -1645,6 +1647,21 @@ MaybeObject* KeyedLoadStubCompiler::GetCode(PropertyType type,
}
+MaybeObject* KeyedLoadStubCompiler::ComputeSharedKeyedLoadElementStub(
+ Map* receiver_map) {
+ MaybeObject* maybe_stub = NULL;
+ if (receiver_map->has_fast_elements()) {
+ maybe_stub = KeyedLoadFastElementStub().TryGetCode();
+ } else if (receiver_map->has_external_array_elements()) {
+ JSObject::ElementsKind elements_kind = receiver_map->elements_kind();
+ maybe_stub = KeyedLoadExternalArrayStub(elements_kind).TryGetCode();
+ } else {
+ UNREACHABLE();
+ }
+ return maybe_stub;
+}
+
+
MaybeObject* StoreStubCompiler::GetCode(PropertyType type, String* name) {
Code::Flags flags = Code::ComputeMonomorphicFlags(
Code::STORE_IC, type, strict_mode_);
@@ -1681,6 +1698,22 @@ MaybeObject* KeyedStoreStubCompiler::GetCode(PropertyType type,
}
+MaybeObject* KeyedStoreStubCompiler::ComputeSharedKeyedStoreElementStub(
+ Map* receiver_map) {
+ MaybeObject* maybe_stub = NULL;
+ if (receiver_map->has_fast_elements()) {
+ bool is_js_array = receiver_map->instance_type() == JS_ARRAY_TYPE;
+ maybe_stub = KeyedStoreFastElementStub(is_js_array).TryGetCode();
+ } else if (receiver_map->has_external_array_elements()) {
+ JSObject::ElementsKind elements_kind = receiver_map->elements_kind();
+ maybe_stub = KeyedStoreExternalArrayStub(elements_kind).TryGetCode();
+ } else {
+ UNREACHABLE();
+ }
+ return maybe_stub;
+}
+
+
CallStubCompiler::CallStubCompiler(int argc,
InLoopFlag in_loop,
Code::Kind kind,
« no previous file with comments | « src/stub-cache.h ('k') | src/x64/stub-cache-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698