| Index: src/stub-cache.cc
|
| ===================================================================
|
| --- src/stub-cache.cc (revision 6800)
|
| +++ src/stub-cache.cc (working copy)
|
| @@ -29,6 +29,7 @@
|
|
|
| #include "api.h"
|
| #include "arguments.h"
|
| +#include "gdb-jit.h"
|
| #include "ic-inl.h"
|
| #include "stub-cache.h"
|
| #include "vm-state-inl.h"
|
| @@ -122,6 +123,7 @@
|
| if (!maybe_code->ToObject(&code)) return maybe_code;
|
| }
|
| PROFILE(CodeCreateEvent(Logger::LOAD_IC_TAG, Code::cast(code), cache_name));
|
| + GDBJIT(AddCode(GDBJITInterface::LOAD_IC, cache_name, Code::cast(code)));
|
| Object* result;
|
| { MaybeObject* maybe_result =
|
| receiver->UpdateMapCodeCache(cache_name, Code::cast(code));
|
| @@ -146,6 +148,7 @@
|
| if (!maybe_code->ToObject(&code)) return maybe_code;
|
| }
|
| PROFILE(CodeCreateEvent(Logger::LOAD_IC_TAG, Code::cast(code), name));
|
| + GDBJIT(AddCode(GDBJITInterface::LOAD_IC, name, Code::cast(code)));
|
| Object* result;
|
| { MaybeObject* maybe_result =
|
| receiver->UpdateMapCodeCache(name, Code::cast(code));
|
| @@ -171,6 +174,7 @@
|
| if (!maybe_code->ToObject(&code)) return maybe_code;
|
| }
|
| PROFILE(CodeCreateEvent(Logger::LOAD_IC_TAG, Code::cast(code), name));
|
| + GDBJIT(AddCode(GDBJITInterface::LOAD_IC, name, Code::cast(code)));
|
| Object* result;
|
| { MaybeObject* maybe_result =
|
| receiver->UpdateMapCodeCache(name, Code::cast(code));
|
| @@ -196,6 +200,7 @@
|
| if (!maybe_code->ToObject(&code)) return maybe_code;
|
| }
|
| PROFILE(CodeCreateEvent(Logger::LOAD_IC_TAG, Code::cast(code), name));
|
| + GDBJIT(AddCode(GDBJITInterface::LOAD_IC, name, Code::cast(code)));
|
| Object* result;
|
| { MaybeObject* maybe_result =
|
| receiver->UpdateMapCodeCache(name, Code::cast(code));
|
| @@ -219,6 +224,7 @@
|
| if (!maybe_code->ToObject(&code)) return maybe_code;
|
| }
|
| PROFILE(CodeCreateEvent(Logger::LOAD_IC_TAG, Code::cast(code), name));
|
| + GDBJIT(AddCode(GDBJITInterface::LOAD_IC, name, Code::cast(code)));
|
| Object* result;
|
| { MaybeObject* maybe_result =
|
| receiver->UpdateMapCodeCache(name, Code::cast(code));
|
| @@ -252,6 +258,7 @@
|
| if (!maybe_code->ToObject(&code)) return maybe_code;
|
| }
|
| PROFILE(CodeCreateEvent(Logger::LOAD_IC_TAG, Code::cast(code), name));
|
| + GDBJIT(AddCode(GDBJITInterface::LOAD_IC, name, Code::cast(code)));
|
| Object* result;
|
| { MaybeObject* maybe_result =
|
| receiver->UpdateMapCodeCache(name, Code::cast(code));
|
| @@ -276,6 +283,7 @@
|
| if (!maybe_code->ToObject(&code)) return maybe_code;
|
| }
|
| PROFILE(CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, Code::cast(code), name));
|
| + GDBJIT(AddCode(GDBJITInterface::KEYED_LOAD_IC, name, Code::cast(code)));
|
| Object* result;
|
| { MaybeObject* maybe_result =
|
| receiver->UpdateMapCodeCache(name, Code::cast(code));
|
| @@ -301,6 +309,7 @@
|
| if (!maybe_code->ToObject(&code)) return maybe_code;
|
| }
|
| PROFILE(CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, Code::cast(code), name));
|
| + GDBJIT(AddCode(GDBJITInterface::KEYED_LOAD_IC, name, Code::cast(code)));
|
| Object* result;
|
| { MaybeObject* maybe_result =
|
| receiver->UpdateMapCodeCache(name, Code::cast(code));
|
| @@ -325,6 +334,7 @@
|
| if (!maybe_code->ToObject(&code)) return maybe_code;
|
| }
|
| PROFILE(CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, Code::cast(code), name));
|
| + GDBJIT(AddCode(GDBJITInterface::KEYED_LOAD_IC, name, Code::cast(code)));
|
| Object* result;
|
| { MaybeObject* maybe_result =
|
| receiver->UpdateMapCodeCache(name, Code::cast(code));
|
| @@ -350,6 +360,7 @@
|
| if (!maybe_code->ToObject(&code)) return maybe_code;
|
| }
|
| PROFILE(CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, Code::cast(code), name));
|
| + GDBJIT(AddCode(GDBJITInterface::KEYED_LOAD_IC, name, Code::cast(code)));
|
| Object* result;
|
| { MaybeObject* maybe_result =
|
| receiver->UpdateMapCodeCache(name, Code::cast(code));
|
| @@ -373,6 +384,7 @@
|
| if (!maybe_code->ToObject(&code)) return maybe_code;
|
| }
|
| PROFILE(CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, Code::cast(code), name));
|
| + GDBJIT(AddCode(GDBJITInterface::KEYED_LOAD_IC, name, Code::cast(code)));
|
| Object* result;
|
| { MaybeObject* maybe_result =
|
| receiver->UpdateMapCodeCache(name, Code::cast(code));
|
| @@ -395,6 +407,7 @@
|
| if (!maybe_code->ToObject(&code)) return maybe_code;
|
| }
|
| PROFILE(CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, Code::cast(code), name));
|
| + GDBJIT(AddCode(GDBJITInterface::KEYED_LOAD_IC, name, Code::cast(code)));
|
| Object* result;
|
| { MaybeObject* maybe_result = map->UpdateCodeCache(name, Code::cast(code));
|
| if (!maybe_result->ToObject(&result)) return maybe_result;
|
| @@ -416,6 +429,7 @@
|
| if (!maybe_code->ToObject(&code)) return maybe_code;
|
| }
|
| PROFILE(CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, Code::cast(code), name));
|
| + GDBJIT(AddCode(GDBJITInterface::KEYED_LOAD_IC, name, Code::cast(code)));
|
| Object* result;
|
| { MaybeObject* maybe_result =
|
| receiver->UpdateMapCodeCache(name, Code::cast(code));
|
| @@ -427,6 +441,12 @@
|
|
|
|
|
| MaybeObject* StubCache::ComputeKeyedLoadSpecialized(JSObject* receiver) {
|
| + // Using NORMAL as the PropertyType for array element loads is a misuse. The
|
| + // generated stub always accesses fast elements, not slow-mode fields, but
|
| + // some property type is required for the stub lookup. Note that overloading
|
| + // the NORMAL PropertyType is only safe as long as no stubs are generated for
|
| + // other keyed field loads. This is guaranteed to be the case since all field
|
| + // keyed loads that are not array elements go through a generic builtin stub.
|
| Code::Flags flags =
|
| Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, NORMAL);
|
| String* name = Heap::KeyedLoadSpecialized_symbol();
|
| @@ -447,20 +467,50 @@
|
| }
|
|
|
|
|
| +MaybeObject* StubCache::ComputeKeyedLoadPixelArray(JSObject* receiver) {
|
| + // Using NORMAL as the PropertyType for array element loads is a misuse. The
|
| + // generated stub always accesses fast elements, not slow-mode fields, but
|
| + // some property type is required for the stub lookup. Note that overloading
|
| + // the NORMAL PropertyType is only safe as long as no stubs are generated for
|
| + // other keyed field loads. This is guaranteed to be the case since all field
|
| + // keyed loads that are not array elements go through a generic builtin stub.
|
| + Code::Flags flags =
|
| + Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, NORMAL);
|
| + String* name = Heap::KeyedLoadPixelArray_symbol();
|
| + Object* code = receiver->map()->FindInCodeCache(name, flags);
|
| + if (code->IsUndefined()) {
|
| + KeyedLoadStubCompiler compiler;
|
| + { MaybeObject* maybe_code = compiler.CompileLoadPixelArray(receiver);
|
| + if (!maybe_code->ToObject(&code)) return maybe_code;
|
| + }
|
| + PROFILE(CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, Code::cast(code), 0));
|
| + Object* result;
|
| + { MaybeObject* maybe_result =
|
| + receiver->UpdateMapCodeCache(name, Code::cast(code));
|
| + if (!maybe_result->ToObject(&result)) return maybe_result;
|
| + }
|
| + }
|
| + return code;
|
| +}
|
| +
|
| +
|
| MaybeObject* StubCache::ComputeStoreField(String* name,
|
| JSObject* receiver,
|
| int field_index,
|
| - Map* transition) {
|
| + Map* transition,
|
| + Code::ExtraICState extra_ic_state) {
|
| PropertyType type = (transition == NULL) ? FIELD : MAP_TRANSITION;
|
| - Code::Flags flags = Code::ComputeMonomorphicFlags(Code::STORE_IC, type);
|
| + Code::Flags flags = Code::ComputeMonomorphicFlags(
|
| + Code::STORE_IC, type, extra_ic_state);
|
| Object* code = receiver->map()->FindInCodeCache(name, flags);
|
| if (code->IsUndefined()) {
|
| - StoreStubCompiler compiler;
|
| + StoreStubCompiler compiler(extra_ic_state);
|
| { MaybeObject* maybe_code =
|
| compiler.CompileStoreField(receiver, field_index, transition, name);
|
| if (!maybe_code->ToObject(&code)) return maybe_code;
|
| }
|
| PROFILE(CodeCreateEvent(Logger::STORE_IC_TAG, Code::cast(code), name));
|
| + GDBJIT(AddCode(GDBJITInterface::STORE_IC, name, Code::cast(code)));
|
| Object* result;
|
| { MaybeObject* maybe_result =
|
| receiver->UpdateMapCodeCache(name, Code::cast(code));
|
| @@ -492,23 +542,123 @@
|
| }
|
|
|
|
|
| -MaybeObject* StubCache::ComputeStoreNormal() {
|
| - return Builtins::builtin(Builtins::StoreIC_Normal);
|
| +MaybeObject* StubCache::ComputeKeyedStorePixelArray(JSObject* receiver) {
|
| + // Using NORMAL as the PropertyType for array element stores is a misuse. The
|
| + // generated stub always accesses fast elements, not slow-mode fields, but
|
| + // some property type is required for the stub lookup. Note that overloading
|
| + // the NORMAL PropertyType is only safe as long as no stubs are generated for
|
| + // other keyed field stores. This is guaranteed to be the case since all field
|
| + // keyed stores that are not array elements go through a generic builtin stub.
|
| + Code::Flags flags =
|
| + Code::ComputeMonomorphicFlags(Code::KEYED_STORE_IC, NORMAL);
|
| + String* name = Heap::KeyedStorePixelArray_symbol();
|
| + Object* code = receiver->map()->FindInCodeCache(name, flags);
|
| + if (code->IsUndefined()) {
|
| + KeyedStoreStubCompiler compiler;
|
| + { MaybeObject* maybe_code = compiler.CompileStorePixelArray(receiver);
|
| + if (!maybe_code->ToObject(&code)) return maybe_code;
|
| + }
|
| + PROFILE(CodeCreateEvent(Logger::KEYED_STORE_IC_TAG, Code::cast(code), 0));
|
| + Object* result;
|
| + { MaybeObject* maybe_result =
|
| + receiver->UpdateMapCodeCache(name, Code::cast(code));
|
| + if (!maybe_result->ToObject(&result)) return maybe_result;
|
| + }
|
| + }
|
| + return code;
|
| }
|
|
|
|
|
| +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(Code::ExtraICState extra_ic_state) {
|
| + return Builtins::builtin(extra_ic_state == StoreIC::kStoreICStrict
|
| + ? Builtins::StoreIC_Normal_Strict
|
| + : Builtins::StoreIC_Normal);
|
| +}
|
| +
|
| +
|
| MaybeObject* StubCache::ComputeStoreGlobal(String* name,
|
| GlobalObject* receiver,
|
| - JSGlobalPropertyCell* cell) {
|
| - Code::Flags flags = Code::ComputeMonomorphicFlags(Code::STORE_IC, NORMAL);
|
| + JSGlobalPropertyCell* cell,
|
| + Code::ExtraICState extra_ic_state) {
|
| + Code::Flags flags = Code::ComputeMonomorphicFlags(
|
| + Code::STORE_IC, NORMAL, extra_ic_state);
|
| Object* code = receiver->map()->FindInCodeCache(name, flags);
|
| if (code->IsUndefined()) {
|
| - StoreStubCompiler compiler;
|
| + StoreStubCompiler compiler(extra_ic_state);
|
| { MaybeObject* maybe_code =
|
| compiler.CompileStoreGlobal(receiver, cell, name);
|
| if (!maybe_code->ToObject(&code)) return maybe_code;
|
| }
|
| PROFILE(CodeCreateEvent(Logger::STORE_IC_TAG, Code::cast(code), name));
|
| + GDBJIT(AddCode(GDBJITInterface::STORE_IC, name, Code::cast(code)));
|
| Object* result;
|
| { MaybeObject* maybe_result =
|
| receiver->UpdateMapCodeCache(name, Code::cast(code));
|
| @@ -519,19 +669,23 @@
|
| }
|
|
|
|
|
| -MaybeObject* StubCache::ComputeStoreCallback(String* name,
|
| - JSObject* receiver,
|
| - AccessorInfo* callback) {
|
| +MaybeObject* StubCache::ComputeStoreCallback(
|
| + String* name,
|
| + JSObject* receiver,
|
| + AccessorInfo* callback,
|
| + Code::ExtraICState extra_ic_state) {
|
| ASSERT(v8::ToCData<Address>(callback->setter()) != 0);
|
| - Code::Flags flags = Code::ComputeMonomorphicFlags(Code::STORE_IC, CALLBACKS);
|
| + Code::Flags flags = Code::ComputeMonomorphicFlags(
|
| + Code::STORE_IC, CALLBACKS, extra_ic_state);
|
| Object* code = receiver->map()->FindInCodeCache(name, flags);
|
| if (code->IsUndefined()) {
|
| - StoreStubCompiler compiler;
|
| + StoreStubCompiler compiler(extra_ic_state);
|
| { MaybeObject* maybe_code =
|
| compiler.CompileStoreCallback(receiver, callback, name);
|
| if (!maybe_code->ToObject(&code)) return maybe_code;
|
| }
|
| PROFILE(CodeCreateEvent(Logger::STORE_IC_TAG, Code::cast(code), name));
|
| + GDBJIT(AddCode(GDBJITInterface::STORE_IC, name, Code::cast(code)));
|
| Object* result;
|
| { MaybeObject* maybe_result =
|
| receiver->UpdateMapCodeCache(name, Code::cast(code));
|
| @@ -542,18 +696,21 @@
|
| }
|
|
|
|
|
| -MaybeObject* StubCache::ComputeStoreInterceptor(String* name,
|
| - JSObject* receiver) {
|
| - Code::Flags flags =
|
| - Code::ComputeMonomorphicFlags(Code::STORE_IC, INTERCEPTOR);
|
| +MaybeObject* StubCache::ComputeStoreInterceptor(
|
| + String* name,
|
| + JSObject* receiver,
|
| + Code::ExtraICState extra_ic_state) {
|
| + Code::Flags flags = Code::ComputeMonomorphicFlags(
|
| + Code::STORE_IC, INTERCEPTOR, extra_ic_state);
|
| Object* code = receiver->map()->FindInCodeCache(name, flags);
|
| if (code->IsUndefined()) {
|
| - StoreStubCompiler compiler;
|
| + StoreStubCompiler compiler(extra_ic_state);
|
| { MaybeObject* maybe_code =
|
| compiler.CompileStoreInterceptor(receiver, name);
|
| if (!maybe_code->ToObject(&code)) return maybe_code;
|
| }
|
| PROFILE(CodeCreateEvent(Logger::STORE_IC_TAG, Code::cast(code), name));
|
| + GDBJIT(AddCode(GDBJITInterface::STORE_IC, name, Code::cast(code)));
|
| Object* result;
|
| { MaybeObject* maybe_result =
|
| receiver->UpdateMapCodeCache(name, Code::cast(code));
|
| @@ -579,6 +736,7 @@
|
| }
|
| PROFILE(CodeCreateEvent(
|
| Logger::KEYED_STORE_IC_TAG, Code::cast(code), name));
|
| + GDBJIT(AddCode(GDBJITInterface::KEYED_STORE_IC, name, Code::cast(code)));
|
| Object* result;
|
| { MaybeObject* maybe_result =
|
| receiver->UpdateMapCodeCache(name, Code::cast(code));
|
| @@ -594,6 +752,7 @@
|
| MaybeObject* StubCache::ComputeCallConstant(int argc,
|
| InLoopFlag in_loop,
|
| Code::Kind kind,
|
| + Code::ExtraICState extra_ic_state,
|
| String* name,
|
| Object* object,
|
| JSObject* holder,
|
| @@ -613,12 +772,12 @@
|
| check = BOOLEAN_CHECK;
|
| }
|
|
|
| - Code::Flags flags =
|
| - Code::ComputeMonomorphicFlags(kind,
|
| - CONSTANT_FUNCTION,
|
| - cache_holder,
|
| - in_loop,
|
| - argc);
|
| + Code::Flags flags = Code::ComputeMonomorphicFlags(kind,
|
| + CONSTANT_FUNCTION,
|
| + extra_ic_state,
|
| + cache_holder,
|
| + in_loop,
|
| + argc);
|
| Object* code = map_holder->map()->FindInCodeCache(name, flags);
|
| if (code->IsUndefined()) {
|
| // If the function hasn't been compiled yet, we cannot do it now
|
| @@ -627,7 +786,8 @@
|
| // caches.
|
| if (!function->is_compiled()) return Failure::InternalError();
|
| // Compile the stub - only create stubs for fully compiled functions.
|
| - CallStubCompiler compiler(argc, in_loop, kind, cache_holder);
|
| + CallStubCompiler compiler(
|
| + argc, in_loop, kind, extra_ic_state, cache_holder);
|
| { MaybeObject* maybe_code =
|
| compiler.CompileCallConstant(object, holder, function, name, check);
|
| if (!maybe_code->ToObject(&code)) return maybe_code;
|
| @@ -636,6 +796,7 @@
|
| ASSERT_EQ(flags, Code::cast(code)->flags());
|
| PROFILE(CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_IC_TAG),
|
| Code::cast(code), name));
|
| + GDBJIT(AddCode(GDBJITInterface::CALL_IC, name, Code::cast(code)));
|
| Object* result;
|
| { MaybeObject* maybe_result =
|
| map_holder->UpdateMapCodeCache(name, Code::cast(code));
|
| @@ -667,12 +828,14 @@
|
|
|
| Code::Flags flags = Code::ComputeMonomorphicFlags(kind,
|
| FIELD,
|
| + Code::kNoExtraICState,
|
| cache_holder,
|
| in_loop,
|
| argc);
|
| Object* code = map_holder->map()->FindInCodeCache(name, flags);
|
| if (code->IsUndefined()) {
|
| - CallStubCompiler compiler(argc, in_loop, kind, cache_holder);
|
| + CallStubCompiler compiler(
|
| + argc, in_loop, kind, Code::kNoExtraICState, cache_holder);
|
| { MaybeObject* maybe_code =
|
| compiler.CompileCallField(JSObject::cast(object),
|
| holder,
|
| @@ -683,6 +846,7 @@
|
| ASSERT_EQ(flags, Code::cast(code)->flags());
|
| PROFILE(CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_IC_TAG),
|
| Code::cast(code), name));
|
| + GDBJIT(AddCode(GDBJITInterface::CALL_IC, name, Code::cast(code)));
|
| Object* result;
|
| { MaybeObject* maybe_result =
|
| map_holder->UpdateMapCodeCache(name, Code::cast(code));
|
| @@ -710,15 +874,16 @@
|
| object = holder;
|
| }
|
|
|
| - Code::Flags flags =
|
| - Code::ComputeMonomorphicFlags(kind,
|
| - INTERCEPTOR,
|
| - cache_holder,
|
| - NOT_IN_LOOP,
|
| - argc);
|
| + Code::Flags flags = Code::ComputeMonomorphicFlags(kind,
|
| + INTERCEPTOR,
|
| + Code::kNoExtraICState,
|
| + cache_holder,
|
| + NOT_IN_LOOP,
|
| + argc);
|
| Object* code = map_holder->map()->FindInCodeCache(name, flags);
|
| if (code->IsUndefined()) {
|
| - CallStubCompiler compiler(argc, NOT_IN_LOOP, kind, cache_holder);
|
| + CallStubCompiler compiler(
|
| + argc, NOT_IN_LOOP, kind, Code::kNoExtraICState, cache_holder);
|
| { MaybeObject* maybe_code =
|
| compiler.CompileCallInterceptor(JSObject::cast(object), holder, name);
|
| if (!maybe_code->ToObject(&code)) return maybe_code;
|
| @@ -726,6 +891,7 @@
|
| ASSERT_EQ(flags, Code::cast(code)->flags());
|
| PROFILE(CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_IC_TAG),
|
| Code::cast(code), name));
|
| + GDBJIT(AddCode(GDBJITInterface::CALL_IC, name, Code::cast(code)));
|
| Object* result;
|
| { MaybeObject* maybe_result =
|
| map_holder->UpdateMapCodeCache(name, Code::cast(code));
|
| @@ -760,12 +926,12 @@
|
| InlineCacheHolderFlag cache_holder =
|
| IC::GetCodeCacheForObject(receiver, holder);
|
| JSObject* map_holder = IC::GetCodeCacheHolder(receiver, cache_holder);
|
| - Code::Flags flags =
|
| - Code::ComputeMonomorphicFlags(kind,
|
| - NORMAL,
|
| - cache_holder,
|
| - in_loop,
|
| - argc);
|
| + Code::Flags flags = Code::ComputeMonomorphicFlags(kind,
|
| + NORMAL,
|
| + Code::kNoExtraICState,
|
| + cache_holder,
|
| + in_loop,
|
| + argc);
|
| Object* code = map_holder->map()->FindInCodeCache(name, flags);
|
| if (code->IsUndefined()) {
|
| // If the function hasn't been compiled yet, we cannot do it now
|
| @@ -773,7 +939,8 @@
|
| // internal error which will make sure we do not update any
|
| // caches.
|
| if (!function->is_compiled()) return Failure::InternalError();
|
| - CallStubCompiler compiler(argc, in_loop, kind, cache_holder);
|
| + CallStubCompiler compiler(
|
| + argc, in_loop, kind, Code::kNoExtraICState, cache_holder);
|
| { MaybeObject* maybe_code =
|
| compiler.CompileCallGlobal(receiver, holder, cell, function, name);
|
| if (!maybe_code->ToObject(&code)) return maybe_code;
|
| @@ -781,6 +948,7 @@
|
| ASSERT_EQ(flags, Code::cast(code)->flags());
|
| PROFILE(CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_IC_TAG),
|
| Code::cast(code), name));
|
| + GDBJIT(AddCode(GDBJITInterface::CALL_IC, name, Code::cast(code)));
|
| Object* result;
|
| { MaybeObject* maybe_result =
|
| map_holder->UpdateMapCodeCache(name, Code::cast(code));
|
| @@ -839,8 +1007,12 @@
|
| Code* StubCache::FindCallInitialize(int argc,
|
| InLoopFlag in_loop,
|
| Code::Kind kind) {
|
| - Code::Flags flags =
|
| - Code::ComputeFlags(kind, in_loop, UNINITIALIZED, NORMAL, argc);
|
| + Code::Flags flags = Code::ComputeFlags(kind,
|
| + in_loop,
|
| + UNINITIALIZED,
|
| + Code::kNoExtraICState,
|
| + NORMAL,
|
| + argc);
|
| Object* result = ProbeCache(flags)->ToObjectUnchecked();
|
| ASSERT(!result->IsUndefined());
|
| // This might be called during the marking phase of the collector
|
| @@ -852,8 +1024,12 @@
|
| MaybeObject* StubCache::ComputeCallInitialize(int argc,
|
| InLoopFlag in_loop,
|
| Code::Kind kind) {
|
| - Code::Flags flags =
|
| - Code::ComputeFlags(kind, in_loop, UNINITIALIZED, NORMAL, argc);
|
| + Code::Flags flags = Code::ComputeFlags(kind,
|
| + in_loop,
|
| + UNINITIALIZED,
|
| + Code::kNoExtraICState,
|
| + NORMAL,
|
| + argc);
|
| Object* probe;
|
| { MaybeObject* maybe_probe = ProbeCache(flags);
|
| if (!maybe_probe->ToObject(&probe)) return maybe_probe;
|
| @@ -895,8 +1071,12 @@
|
| MaybeObject* StubCache::ComputeCallPreMonomorphic(int argc,
|
| InLoopFlag in_loop,
|
| Code::Kind kind) {
|
| - Code::Flags flags =
|
| - Code::ComputeFlags(kind, in_loop, PREMONOMORPHIC, NORMAL, argc);
|
| + Code::Flags flags = Code::ComputeFlags(kind,
|
| + in_loop,
|
| + PREMONOMORPHIC,
|
| + Code::kNoExtraICState,
|
| + NORMAL,
|
| + argc);
|
| Object* probe;
|
| { MaybeObject* maybe_probe = ProbeCache(flags);
|
| if (!maybe_probe->ToObject(&probe)) return maybe_probe;
|
| @@ -910,8 +1090,12 @@
|
| MaybeObject* StubCache::ComputeCallNormal(int argc,
|
| InLoopFlag in_loop,
|
| Code::Kind kind) {
|
| - Code::Flags flags =
|
| - Code::ComputeFlags(kind, in_loop, MONOMORPHIC, NORMAL, argc);
|
| + Code::Flags flags = Code::ComputeFlags(kind,
|
| + in_loop,
|
| + MONOMORPHIC,
|
| + Code::kNoExtraICState,
|
| + NORMAL,
|
| + argc);
|
| Object* probe;
|
| { MaybeObject* maybe_probe = ProbeCache(flags);
|
| if (!maybe_probe->ToObject(&probe)) return maybe_probe;
|
| @@ -925,8 +1109,12 @@
|
| MaybeObject* StubCache::ComputeCallMegamorphic(int argc,
|
| InLoopFlag in_loop,
|
| Code::Kind kind) {
|
| - Code::Flags flags =
|
| - Code::ComputeFlags(kind, in_loop, MEGAMORPHIC, NORMAL, argc);
|
| + Code::Flags flags = Code::ComputeFlags(kind,
|
| + in_loop,
|
| + MEGAMORPHIC,
|
| + Code::kNoExtraICState,
|
| + NORMAL,
|
| + argc);
|
| Object* probe;
|
| { MaybeObject* maybe_probe = ProbeCache(flags);
|
| if (!maybe_probe->ToObject(&probe)) return maybe_probe;
|
| @@ -940,8 +1128,13 @@
|
| MaybeObject* StubCache::ComputeCallMiss(int argc, Code::Kind kind) {
|
| // MONOMORPHIC_PROTOTYPE_FAILURE state is used to make sure that miss stubs
|
| // and monomorphic stubs are not mixed up together in the stub cache.
|
| - Code::Flags flags = Code::ComputeFlags(
|
| - kind, NOT_IN_LOOP, MONOMORPHIC_PROTOTYPE_FAILURE, NORMAL, argc);
|
| + Code::Flags flags = Code::ComputeFlags(kind,
|
| + NOT_IN_LOOP,
|
| + MONOMORPHIC_PROTOTYPE_FAILURE,
|
| + Code::kNoExtraICState,
|
| + NORMAL,
|
| + argc,
|
| + OWN_MAP);
|
| Object* probe;
|
| { MaybeObject* maybe_probe = ProbeCache(flags);
|
| if (!maybe_probe->ToObject(&probe)) return maybe_probe;
|
| @@ -954,8 +1147,12 @@
|
|
|
| #ifdef ENABLE_DEBUGGER_SUPPORT
|
| MaybeObject* StubCache::ComputeCallDebugBreak(int argc, Code::Kind kind) {
|
| - Code::Flags flags =
|
| - Code::ComputeFlags(kind, NOT_IN_LOOP, DEBUG_BREAK, NORMAL, argc);
|
| + Code::Flags flags = Code::ComputeFlags(kind,
|
| + NOT_IN_LOOP,
|
| + DEBUG_BREAK,
|
| + Code::kNoExtraICState,
|
| + NORMAL,
|
| + argc);
|
| Object* probe;
|
| { MaybeObject* maybe_probe = ProbeCache(flags);
|
| if (!maybe_probe->ToObject(&probe)) return maybe_probe;
|
| @@ -968,12 +1165,12 @@
|
|
|
| MaybeObject* StubCache::ComputeCallDebugPrepareStepIn(int argc,
|
| Code::Kind kind) {
|
| - Code::Flags flags =
|
| - Code::ComputeFlags(kind,
|
| - NOT_IN_LOOP,
|
| - DEBUG_PREPARE_STEP_IN,
|
| - NORMAL,
|
| - argc);
|
| + Code::Flags flags = Code::ComputeFlags(kind,
|
| + NOT_IN_LOOP,
|
| + DEBUG_PREPARE_STEP_IN,
|
| + Code::kNoExtraICState,
|
| + NORMAL,
|
| + argc);
|
| Object* probe;
|
| { MaybeObject* maybe_probe = ProbeCache(flags);
|
| if (!maybe_probe->ToObject(&probe)) return maybe_probe;
|
| @@ -1257,6 +1454,7 @@
|
| USE(code);
|
| PROFILE(CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_INITIALIZE_TAG),
|
| code, code->arguments_count()));
|
| + GDBJIT(AddCode(GDBJITInterface::CALL_INITIALIZE, Code::cast(code)));
|
| return result;
|
| }
|
|
|
| @@ -1282,6 +1480,7 @@
|
| USE(code);
|
| PROFILE(CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_PRE_MONOMORPHIC_TAG),
|
| code, code->arguments_count()));
|
| + GDBJIT(AddCode(GDBJITInterface::CALL_PRE_MONOMORPHIC, Code::cast(code)));
|
| return result;
|
| }
|
|
|
| @@ -1304,6 +1503,7 @@
|
| USE(code);
|
| PROFILE(CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_NORMAL_TAG),
|
| code, code->arguments_count()));
|
| + GDBJIT(AddCode(GDBJITInterface::CALL_NORMAL, Code::cast(code)));
|
| return result;
|
| }
|
|
|
| @@ -1328,6 +1528,7 @@
|
| USE(code);
|
| PROFILE(CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_MEGAMORPHIC_TAG),
|
| code, code->arguments_count()));
|
| + GDBJIT(AddCode(GDBJITInterface::CALL_MEGAMORPHIC, Code::cast(code)));
|
| return result;
|
| }
|
|
|
| @@ -1350,6 +1551,7 @@
|
| USE(code);
|
| PROFILE(CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_MISS_TAG),
|
| code, code->arguments_count()));
|
| + GDBJIT(AddCode(GDBJITInterface::CALL_MISS, Code::cast(code)));
|
| return result;
|
| }
|
|
|
| @@ -1449,6 +1651,9 @@
|
| PROFILE(CodeCreateEvent(Logger::LOAD_IC_TAG,
|
| Code::cast(result->ToObjectUnchecked()),
|
| name));
|
| + GDBJIT(AddCode(GDBJITInterface::LOAD_IC,
|
| + name,
|
| + Code::cast(result->ToObjectUnchecked())));
|
| }
|
| return result;
|
| }
|
| @@ -1461,18 +1666,25 @@
|
| PROFILE(CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG,
|
| Code::cast(result->ToObjectUnchecked()),
|
| name));
|
| + GDBJIT(AddCode(GDBJITInterface::LOAD_IC,
|
| + name,
|
| + Code::cast(result->ToObjectUnchecked())));
|
| }
|
| return result;
|
| }
|
|
|
|
|
| MaybeObject* StoreStubCompiler::GetCode(PropertyType type, String* name) {
|
| - Code::Flags flags = Code::ComputeMonomorphicFlags(Code::STORE_IC, type);
|
| + Code::Flags flags = Code::ComputeMonomorphicFlags(Code::STORE_IC, type,
|
| + extra_ic_state_);
|
| MaybeObject* result = GetCodeWithFlags(flags, name);
|
| if (!result->IsFailure()) {
|
| PROFILE(CodeCreateEvent(Logger::STORE_IC_TAG,
|
| Code::cast(result->ToObjectUnchecked()),
|
| name));
|
| + GDBJIT(AddCode(GDBJITInterface::STORE_IC,
|
| + name,
|
| + Code::cast(result->ToObjectUnchecked())));
|
| }
|
| return result;
|
| }
|
| @@ -1485,6 +1697,9 @@
|
| PROFILE(CodeCreateEvent(Logger::KEYED_STORE_IC_TAG,
|
| Code::cast(result->ToObjectUnchecked()),
|
| name));
|
| + GDBJIT(AddCode(GDBJITInterface::KEYED_STORE_IC,
|
| + name,
|
| + Code::cast(result->ToObjectUnchecked())));
|
| }
|
| return result;
|
| }
|
| @@ -1493,11 +1708,13 @@
|
| CallStubCompiler::CallStubCompiler(int argc,
|
| InLoopFlag in_loop,
|
| Code::Kind kind,
|
| + Code::ExtraICState extra_ic_state,
|
| InlineCacheHolderFlag cache_holder)
|
| - : arguments_(argc)
|
| - , in_loop_(in_loop)
|
| - , kind_(kind)
|
| - , cache_holder_(cache_holder) {
|
| + : arguments_(argc),
|
| + in_loop_(in_loop),
|
| + kind_(kind),
|
| + extra_ic_state_(extra_ic_state),
|
| + cache_holder_(cache_holder) {
|
| }
|
|
|
|
|
| @@ -1534,6 +1751,7 @@
|
| int argc = arguments_.immediate();
|
| Code::Flags flags = Code::ComputeMonomorphicFlags(kind_,
|
| type,
|
| + extra_ic_state_,
|
| cache_holder_,
|
| in_loop_,
|
| argc);
|
| @@ -1559,6 +1777,7 @@
|
| Code* code = Code::cast(result);
|
| USE(code);
|
| PROFILE(CodeCreateEvent(Logger::STUB_TAG, code, "ConstructStub"));
|
| + GDBJIT(AddCode(GDBJITInterface::STUB, "ConstructStub", Code::cast(code)));
|
| return result;
|
| }
|
|
|
| @@ -1630,4 +1849,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
|
|
|