| Index: src/stub-cache.cc
|
| diff --git a/src/stub-cache.cc b/src/stub-cache.cc
|
| index 86e72012135fb305bf5f6e3c660b1648e3a9172e..6539e9168a481cbb90aaea7e394d8abab0ffc678 100644
|
| --- a/src/stub-cache.cc
|
| +++ b/src/stub-cache.cc
|
| @@ -594,6 +594,7 @@ MaybeObject* StubCache::ComputeKeyedStoreField(String* name,
|
| MaybeObject* StubCache::ComputeCallConstant(int argc,
|
| InLoopFlag in_loop,
|
| Code::Kind kind,
|
| + Code::ExtraICState extra_ic_state,
|
| String* name,
|
| Object* object,
|
| JSObject* holder,
|
| @@ -613,12 +614,12 @@ MaybeObject* StubCache::ComputeCallConstant(int argc,
|
| 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 +628,8 @@ MaybeObject* StubCache::ComputeCallConstant(int argc,
|
| // 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;
|
| @@ -667,12 +669,14 @@ MaybeObject* StubCache::ComputeCallField(int argc,
|
|
|
| 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,
|
| @@ -710,15 +714,16 @@ MaybeObject* StubCache::ComputeCallInterceptor(int argc,
|
| 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;
|
| @@ -760,12 +765,12 @@ MaybeObject* StubCache::ComputeCallGlobal(int argc,
|
| 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 +778,8 @@ MaybeObject* StubCache::ComputeCallGlobal(int argc,
|
| // 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;
|
| @@ -839,8 +845,12 @@ static MaybeObject* FillCache(MaybeObject* maybe_code) {
|
| 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 +862,12 @@ Code* StubCache::FindCallInitialize(int argc,
|
| 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 +909,12 @@ Handle<Code> StubCache::ComputeKeyedCallInitialize(int argc,
|
| 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 +928,12 @@ MaybeObject* StubCache::ComputeCallPreMonomorphic(int argc,
|
| 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 +947,12 @@ MaybeObject* StubCache::ComputeCallNormal(int argc,
|
| 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;
|
| @@ -937,11 +963,18 @@ MaybeObject* StubCache::ComputeCallMegamorphic(int argc,
|
| }
|
|
|
|
|
| -MaybeObject* StubCache::ComputeCallMiss(int argc, Code::Kind kind) {
|
| +MaybeObject* StubCache::ComputeCallMiss(int argc,
|
| + Code::Kind kind,
|
| + Code::ExtraICState extra_ic_state) {
|
| // 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,
|
| + extra_ic_state,
|
| + NORMAL,
|
| + argc,
|
| + OWN_MAP);
|
| Object* probe;
|
| { MaybeObject* maybe_probe = ProbeCache(flags);
|
| if (!maybe_probe->ToObject(&probe)) return maybe_probe;
|
| @@ -954,8 +987,12 @@ MaybeObject* StubCache::ComputeCallMiss(int argc, Code::Kind kind) {
|
|
|
| #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 +1005,12 @@ MaybeObject* StubCache::ComputeCallDebugBreak(int argc, Code::Kind kind) {
|
|
|
| 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;
|
| @@ -1336,8 +1373,9 @@ MaybeObject* StubCompiler::CompileCallMiss(Code::Flags flags) {
|
| HandleScope scope;
|
| int argc = Code::ExtractArgumentsCountFromFlags(flags);
|
| Code::Kind kind = Code::ExtractKindFromFlags(flags);
|
| + Code::ExtraICState extra_ic_state = Code::ExtractExtraICStateFromFlags(flags);
|
| if (kind == Code::CALL_IC) {
|
| - CallIC::GenerateMiss(masm(), argc);
|
| + CallIC::GenerateMiss(masm(), extra_ic_state, argc);
|
| } else {
|
| KeyedCallIC::GenerateMiss(masm(), argc);
|
| }
|
| @@ -1379,8 +1417,9 @@ MaybeObject* StubCompiler::CompileCallDebugPrepareStepIn(Code::Flags flags) {
|
| // the miss case.
|
| int argc = Code::ExtractArgumentsCountFromFlags(flags);
|
| Code::Kind kind = Code::ExtractKindFromFlags(flags);
|
| + Code::ExtraICState extra_ic_state = Code::ExtractExtraICStateFromFlags(flags);
|
| if (kind == Code::CALL_IC) {
|
| - CallIC::GenerateMiss(masm(), argc);
|
| + CallIC::GenerateMiss(masm(), extra_ic_state, argc);
|
| } else {
|
| KeyedCallIC::GenerateMiss(masm(), argc);
|
| }
|
| @@ -1493,11 +1532,13 @@ MaybeObject* KeyedStoreStubCompiler::GetCode(PropertyType type, String* name) {
|
| 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 +1575,7 @@ MaybeObject* CallStubCompiler::GetCode(PropertyType type, String* name) {
|
| int argc = arguments_.immediate();
|
| Code::Flags flags = Code::ComputeMonomorphicFlags(kind_,
|
| type,
|
| + extra_ic_state_,
|
| cache_holder_,
|
| in_loop_,
|
| argc);
|
| @@ -1550,6 +1592,18 @@ MaybeObject* CallStubCompiler::GetCode(JSFunction* function) {
|
| }
|
|
|
|
|
| +MaybeObject* CallStubCompiler::GenerateMissBranch() {
|
| + return GenerateBranchHelper(extra_ic_state_);
|
| +}
|
| +
|
| +
|
| +MaybeObject* CallStubCompiler::GenerateExtraStateChangeBranch(
|
| + Code::ExtraICState new_extra_ic_state) {
|
| + ASSERT(extra_ic_state_ != new_extra_ic_state);
|
| + return GenerateBranchHelper(new_extra_ic_state);
|
| +}
|
| +
|
| +
|
| MaybeObject* ConstructStubCompiler::GetCode() {
|
| Code::Flags flags = Code::ComputeFlags(Code::STUB);
|
| Object* result;
|
|
|