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

Unified Diff: src/stub-cache.cc

Issue 6303012: Truncate rather than round to nearest when performing float-to-integer... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 9 years, 11 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/stub-cache.cc
===================================================================
--- src/stub-cache.cc (revision 6406)
+++ src/stub-cache.cc (working copy)
@@ -507,6 +507,74 @@
}
+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;
+ default:
+ UNREACHABLE();
+ return static_cast<ExternalArrayType>(0);
+ }
+}
+
+} // anonymous namespace
+
+
+MaybeObject* StubCache::ComputeKeyedLoadOrStoreExternalArray(
+ JSObject* receiver,
+ bool is_store) {
+ Code::Flags flags =
+ Code::ComputeMonomorphicFlags(
+ is_store ? Code::KEYED_STORE_IC : Code::KEYED_LOAD_IC,
+ NORMAL);
+ ExternalArrayType array_type =
+ ElementsKindToExternalArrayType(receiver->GetElementsKind());
+ String* name =
+ is_store ? Heap::KeyedStoreExternalArray_symbol()
+ : Heap::KeyedLoadExternalArray_symbol();
+ // Use the global maps for the particular external array types,
+ // rather than the receiver's map, when looking up the cached code,
+ // so that we actually canonicalize these stubs.
+ Map* map = Heap::MapForExternalArrayType(array_type);
+ Object* code = map->FindInCodeCache(name, flags);
+ if (code->IsUndefined()) {
+ ExternalArrayStubCompiler compiler;
+ { MaybeObject* maybe_code =
+ is_store ? compiler.CompileKeyedStoreStub(array_type, flags) :
+ compiler.CompileKeyedLoadStub(array_type, flags);
+ if (!maybe_code->ToObject(&code)) return maybe_code;
+ }
+ if (is_store) {
+ PROFILE(
+ CodeCreateEvent(Logger::KEYED_STORE_IC_TAG, Code::cast(code), 0));
+ } else {
+ PROFILE(
+ CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, Code::cast(code), 0));
+ }
+ Object* result;
+ { MaybeObject* maybe_result =
+ map->UpdateCodeCache(name, Code::cast(code));
+ if (!maybe_result->ToObject(&result)) return maybe_result;
+ }
+ }
+ return code;
+}
+
+
MaybeObject* StubCache::ComputeStoreNormal() {
return Builtins::builtin(Builtins::StoreIC_Normal);
}
@@ -1709,4 +1777,16 @@
}
+MaybeObject* ExternalArrayStubCompiler::GetCode(Code::Flags flags) {
+ Object* result;
+ { MaybeObject* maybe_result = GetCodeWithFlags(flags, "ExternalArrayStub");
+ if (!maybe_result->ToObject(&result)) return maybe_result;
+ }
+ Code* code = Code::cast(result);
+ USE(code);
+ PROFILE(CodeCreateEvent(Logger::STUB_TAG, code, "ExternalArrayStub"));
+ return result;
+}
+
+
} } // namespace v8::internal
« src/ia32/stub-cache-ia32.cc ('K') | « src/stub-cache.h ('k') | src/x64/assembler-x64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698