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

Unified Diff: src/stub-cache.cc

Issue 7112010: Plumbing changes to merge various element kind implementaions. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: review feedback 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/type-info.h » ('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 8c6d84c6130f15cab22fc42466af5a632e011707..7bbb333f1156011f9f84f788a0722e7401f477f0 100644
--- a/src/stub-cache.cc
+++ b/src/stub-cache.cc
@@ -485,38 +485,7 @@ MaybeObject* StubCache::ComputeStoreField(String* name,
}
-namespace {
-
-ExternalArrayType ElementsKindToExternalArrayType(JSObject::ElementsKind kind) {
- switch (kind) {
- case JSObject::EXTERNAL_BYTE_ELEMENTS:
- return kExternalByteArray;
- case JSObject::EXTERNAL_UNSIGNED_BYTE_ELEMENTS:
- return kExternalUnsignedByteArray;
- case JSObject::EXTERNAL_SHORT_ELEMENTS:
- return kExternalShortArray;
- case JSObject::EXTERNAL_UNSIGNED_SHORT_ELEMENTS:
- return kExternalUnsignedShortArray;
- case JSObject::EXTERNAL_INT_ELEMENTS:
- return kExternalIntArray;
- case JSObject::EXTERNAL_UNSIGNED_INT_ELEMENTS:
- return kExternalUnsignedIntArray;
- case JSObject::EXTERNAL_FLOAT_ELEMENTS:
- return kExternalFloatArray;
- case JSObject::EXTERNAL_DOUBLE_ELEMENTS:
- return kExternalDoubleArray;
- case JSObject::EXTERNAL_PIXEL_ELEMENTS:
- return kExternalPixelArray;
- default:
- UNREACHABLE();
- return static_cast<ExternalArrayType>(0);
- }
-}
-
-} // anonymous namespace
-
-
-MaybeObject* StubCache::ComputeKeyedLoadOrStoreExternalArray(
+MaybeObject* StubCache::ComputeKeyedLoadOrStoreElement(
JSObject* receiver,
bool is_store,
StrictModeFlag strict_mode) {
@@ -526,67 +495,19 @@ MaybeObject* StubCache::ComputeKeyedLoadOrStoreExternalArray(
Code::KEYED_LOAD_IC,
NORMAL,
strict_mode);
- ExternalArrayType array_type =
- ElementsKindToExternalArrayType(receiver->GetElementsKind());
String* name = is_store
- ? isolate()->heap()->KeyedStoreSpecializedMonomorphic_symbol()
- : isolate()->heap()->KeyedLoadSpecializedMonomorphic_symbol();
- Object* maybe_code = receiver->map()->FindInCodeCache(name, flags);
- if (!maybe_code->IsUndefined()) return Code::cast(maybe_code);
-
- MaybeObject* maybe_new_code = NULL;
- if (is_store) {
- ExternalArrayStoreStubCompiler compiler(strict_mode);
- maybe_new_code = compiler.CompileStore(receiver, array_type);
- } else {
- ExternalArrayLoadStubCompiler compiler(strict_mode);
- maybe_new_code = compiler.CompileLoad(receiver, array_type);
- }
- Code* code;
- if (!maybe_new_code->To(&code)) return maybe_new_code;
- code->set_external_array_type(array_type);
- if (is_store) {
- PROFILE(isolate_,
- CodeCreateEvent(Logger::KEYED_EXTERNAL_ARRAY_STORE_IC_TAG,
- Code::cast(code), 0));
- } else {
- PROFILE(isolate_,
- CodeCreateEvent(Logger::KEYED_EXTERNAL_ARRAY_LOAD_IC_TAG,
- Code::cast(code), 0));
- }
- ASSERT(code->IsCode());
- Object* result;
- { MaybeObject* maybe_result =
- receiver->UpdateMapCodeCache(name, Code::cast(code));
- if (!maybe_result->ToObject(&result)) return maybe_result;
- }
- return code;
-}
-
-
-MaybeObject* StubCache::ComputeKeyedLoadOrStoreFastElement(
- JSObject* receiver,
- bool is_store,
- StrictModeFlag strict_mode) {
- Code::Flags flags =
- Code::ComputeMonomorphicFlags(
- is_store ? Code::KEYED_STORE_IC :
- Code::KEYED_LOAD_IC,
- NORMAL,
- strict_mode);
- String* name = is_store
- ? isolate()->heap()->KeyedStoreSpecializedMonomorphic_symbol()
- : isolate()->heap()->KeyedLoadSpecializedMonomorphic_symbol();
+ ? isolate()->heap()->KeyedStoreElementMonomorphic_symbol()
+ : isolate()->heap()->KeyedLoadElementMonomorphic_symbol();
Object* maybe_code = receiver->map()->FindInCodeCache(name, flags);
if (!maybe_code->IsUndefined()) return Code::cast(maybe_code);
MaybeObject* maybe_new_code = NULL;
if (is_store) {
KeyedStoreStubCompiler compiler(strict_mode);
- maybe_new_code = compiler.CompileStoreFastElement(receiver->map());
+ maybe_new_code = compiler.CompileStoreElement(receiver->map());
} else {
KeyedLoadStubCompiler compiler;
- maybe_new_code = compiler.CompileLoadFastElement(receiver->map());
+ maybe_new_code = compiler.CompileLoadElement(receiver->map());
}
Code* code;
if (!maybe_new_code->To(&code)) return maybe_new_code;
@@ -1923,38 +1844,4 @@ void CallOptimization::AnalyzePossibleApiFunction(JSFunction* function) {
}
-MaybeObject* ExternalArrayLoadStubCompiler::GetCode() {
- Object* result;
- Code::Flags flags = Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC,
- NORMAL,
- strict_mode_);
- { MaybeObject* maybe_result = GetCodeWithFlags(flags,
- "ExternalArrayLoadStub");
- if (!maybe_result->ToObject(&result)) return maybe_result;
- }
- Code* code = Code::cast(result);
- USE(code);
- PROFILE(isolate(),
- CodeCreateEvent(Logger::STUB_TAG, code, "ExternalArrayLoadStub"));
- return result;
-}
-
-
-MaybeObject* ExternalArrayStoreStubCompiler::GetCode() {
- Object* result;
- Code::Flags flags = Code::ComputeMonomorphicFlags(Code::KEYED_STORE_IC,
- NORMAL,
- strict_mode_);
- { MaybeObject* maybe_result = GetCodeWithFlags(flags,
- "ExternalArrayStoreStub");
- if (!maybe_result->ToObject(&result)) return maybe_result;
- }
- Code* code = Code::cast(result);
- USE(code);
- PROFILE(isolate(),
- CodeCreateEvent(Logger::STUB_TAG, code, "ExternalArrayStoreStub"));
- return result;
-}
-
-
} } // namespace v8::internal
« no previous file with comments | « src/stub-cache.h ('k') | src/type-info.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698