bool IC::UpdatePolymorphicIC(State state,
- Handle<HeapObject> receiver,
+ Handle<JSObject> receiver,
Handle<String> name,
Handle<Code> code,
StrictModeFlag strict_mode) {
}
-void LoadIC::UpdateMonomorphicIC(Handle<HeapObject> receiver,
+void LoadIC::UpdateMonomorphicIC(Handle<JSObject> receiver,
Handle<Code> handler,
Handle<String> name,
StrictModeFlag strict_mode) {
- if (handler->is_load_stub()) return set_target(*handler);
+ if (handler->type() == Code::NORMAL) return set_target(*handler);
Handle<Code> ic = isolate()->stub_cache()->ComputeMonomorphicLoadIC(
receiver, handler, name);
set_target(*ic);
}
-void KeyedLoadIC::UpdateMonomorphicIC(Handle<HeapObject> receiver,
+void KeyedLoadIC::UpdateMonomorphicIC(Handle<JSObject> receiver,
Handle<Code> handler,
Handle<String> name,
StrictModeFlag strict_mode) {
- if (handler->is_keyed_load_stub()) return set_target(*handler);
+ if (handler->type() == Code::NORMAL) return set_target(*handler);
Handle<Code> ic = isolate()->stub_cache()->ComputeMonomorphicKeyedLoadIC(
receiver, handler, name);
set_target(*ic);
}
-void StoreIC::UpdateMonomorphicIC(Handle<HeapObject> receiver,
+void StoreIC::UpdateMonomorphicIC(Handle<JSObject> receiver,
Handle<Code> handler,
Handle<String> name,
StrictModeFlag strict_mode) {
- if (handler->is_store_stub()) return set_target(*handler);
+ if (handler->type() == Code::NORMAL) return set_target(*handler);
Handle<Code> ic = isolate()->stub_cache()->ComputeMonomorphicStoreIC(
receiver, handler, name, strict_mode);
set_target(*ic);
}
-void KeyedStoreIC::UpdateMonomorphicIC(Handle<HeapObject> receiver,
+void KeyedStoreIC::UpdateMonomorphicIC(Handle<JSObject> receiver,
Handle<Code> handler,
Handle<String> name,
StrictModeFlag strict_mode) {
- if (handler->is_keyed_store_stub()) return set_target(*handler);
+ if (handler->type() == Code::NORMAL) return set_target(*handler);
Handle<Code> ic = isolate()->stub_cache()->ComputeMonomorphicKeyedStoreIC(
receiver, handler, name, strict_mode);
set_target(*ic);
// not necessarily equal to target()->state().
void IC::PatchCache(State state,
StrictModeFlag strict_mode,
- Handle<HeapObject> receiver,
+ Handle<JSObject> receiver,
Handle<String> name,
Handle<Code> code) {
switch (state) {
State state,
Handle<Object> object,
Handle<String> name) {
- if (!object->IsHeapObject()) return;
+ // Bail out if the result is not cacheable.
+ if (!lookup->IsCacheable()) {
+ set_target(*generic_stub());
+ return;
+ }
- Handle<HeapObject> receiver = Handle<HeapObject>::cast(object);
+ // TODO(jkummerow): It would be nice to support non-JSObjects in
+ // UpdateCaches, then we wouldn't need to go generic here.
+ if (!object->IsJSObject()) {
+ set_target(*generic_stub());
+ return;
+ }
+ Handle<JSObject> receiver = Handle<JSObject>::cast(object);
Handle<Code> code;
if (state == UNINITIALIZED) {
// This is the first time we execute this inline cache.
// Set the target to the pre monomorphic stub to delay
// setting the monomorphic state.
code = pre_monomorphic_stub();
- } else if (!lookup->IsCacheable()) {
- // Bail out if the result is not cacheable.
- code = slow_stub();
- } else if (!object->IsJSObject()) {
- // TODO(jkummerow): It would be nice to support non-JSObjects in
- // ComputeLoadHandler, then we wouldn't need to go generic here.
- code = slow_stub();
} else {
- code = ComputeLoadHandler(lookup, Handle<JSObject>::cast(receiver), name);
- if (code.is_null()) code = slow_stub();
+ code = ComputeLoadHandler(lookup, receiver, name);
+ if (code.is_null()) {
+ set_target(*generic_stub());
+ return;
+ }
}
PatchCache(state, kNonStrictMode, receiver, name, code);
}
-Handle<Code> StubCache::ComputeMonomorphicLoadIC(Handle<HeapObject> receiver,
+Handle<Code> StubCache::ComputeMonomorphicLoadIC(Handle<JSObject> receiver,
Handle<Code> handler,
Handle<Name> name) {
- Handle<Map> map(receiver->map());
- Handle<Code> ic = FindIC(name, map, Code::LOAD_IC, handler->type());
+ Handle<Code> ic = FindIC(name, receiver, Code::LOAD_IC, handler->type());
if (!ic.is_null()) return ic;
LoadStubCompiler ic_compiler(isolate());
- ic = ic_compiler.CompileMonomorphicIC(map, handler, name);
+ ic = ic_compiler.CompileMonomorphicIC(
+ Handle<Map>(receiver->map()), handler, name);
- HeapObject::UpdateMapCodeCache(receiver, name, ic);
+ JSObject::UpdateMapCodeCache(receiver, name, ic);
return ic;
}
-Handle<Code> StubCache::ComputeMonomorphicKeyedLoadIC(
- Handle<HeapObject> receiver,
- Handle<Code> handler,
- Handle<Name> name) {
- Handle<Map> map(receiver->map());
- Handle<Code> ic = FindIC(name, map, Code::KEYED_LOAD_IC, handler->type());
+Handle<Code> StubCache::ComputeMonomorphicKeyedLoadIC(Handle<JSObject> receiver,
+ Handle<Code> handler,
+ Handle<Name> name) {
+ Handle<Code> ic = FindIC(
+ name, receiver, Code::KEYED_LOAD_IC, handler->type());
if (!ic.is_null()) return ic;
KeyedLoadStubCompiler ic_compiler(isolate());
- ic = ic_compiler.CompileMonomorphicIC(map, handler, name);
+ ic = ic_compiler.CompileMonomorphicIC(
+ Handle<Map>(receiver->map()), handler, name);
- HeapObject::UpdateMapCodeCache(receiver, name, ic);
+ JSObject::UpdateMapCodeCache(receiver, name, ic);
return ic;
}
-Handle<Code> StubCache::ComputeMonomorphicStoreIC(Handle<HeapObject> receiver,
+Handle<Code> StubCache::ComputeMonomorphicStoreIC(Handle<JSObject> receiver,
Handle<Code> handler,
Handle<Name> name,
StrictModeFlag strict_mode) {
- Handle<Map> map(receiver->map());
Handle<Code> ic = FindIC(
- name, map, Code::STORE_IC, handler->type(), strict_mode);
+ name, receiver, Code::STORE_IC, handler->type(), strict_mode);
if (!ic.is_null()) return ic;
StoreStubCompiler ic_compiler(isolate(), strict_mode);
- ic = ic_compiler.CompileMonomorphicIC(map, handler, name);
+ ic = ic_compiler.CompileMonomorphicIC(
+ Handle<Map>(receiver->map()), handler, name);
- HeapObject::UpdateMapCodeCache(receiver, name, ic);
+ JSObject::UpdateMapCodeCache(receiver, name, ic);
return ic;
}
Handle<Code> StubCache::ComputeMonomorphicKeyedStoreIC(
- Handle<HeapObject> receiver,
+ Handle<JSObject> receiver,
Handle<Code> handler,
Handle<Name> name,
StrictModeFlag strict_mode) {
- Handle<Map> map(receiver->map());
Handle<Code> ic = FindIC(
- name, map, Code::KEYED_STORE_IC, handler->type(), strict_mode);
+ name, receiver, Code::KEYED_STORE_IC, handler->type(), strict_mode);
if (!ic.is_null()) return ic;
KeyedStoreStubCompiler ic_compiler(isolate(), strict_mode, STANDARD_STORE);
- ic = ic_compiler.CompileMonomorphicIC(map, handler, name);
+ ic = ic_compiler.CompileMonomorphicIC(
+ Handle<Map>(receiver->map()), handler, name);
- HeapObject::UpdateMapCodeCache(receiver, name, ic);
+ JSObject::UpdateMapCodeCache(receiver, name, ic);
return ic;
}
LoadStubCompiler compiler(isolate_);
handler =
compiler.CompileLoadNonexistent(receiver, current, cache_name, global);
- HeapObject::UpdateMapCodeCache(receiver, cache_name, handler);
+ JSObject::UpdateMapCodeCache(receiver, cache_name, handler);
return handler;
}
LoadStubCompiler compiler(isolate_);
Handle<Code> handler =
compiler.CompileLoadField(receiver, holder, name, field, representation);
- HeapObject::UpdateMapCodeCache(stub_holder, name, handler);
+ JSObject::UpdateMapCodeCache(stub_holder, name, handler);
return handler;
}
LoadStubCompiler compiler(isolate_);
Handle<Code> handler =
compiler.CompileLoadCallback(receiver, holder, name, callback);
- HeapObject::UpdateMapCodeCache(stub_holder, name, handler);
+ JSObject::UpdateMapCodeCache(stub_holder, name, handler);
return handler;
}
LoadStubCompiler compiler(isolate_);
Handle<Code> handler =
compiler.CompileLoadCallback(receiver, holder, name, call_optimization);
- HeapObject::UpdateMapCodeCache(stub_holder, name, handler);
+ JSObject::UpdateMapCodeCache(stub_holder, name, handler);
return handler;
}
LoadStubCompiler compiler(isolate_);
Handle<Code> handler =
compiler.CompileLoadViaGetter(receiver, holder, name, getter);
- HeapObject::UpdateMapCodeCache(stub_holder, name, handler);
+ JSObject::UpdateMapCodeCache(stub_holder, name, handler);
return handler;
}
LoadStubCompiler compiler(isolate_);
handler = compiler.CompileLoadConstant(receiver, holder, name, value);
- HeapObject::UpdateMapCodeCache(stub_holder, name, handler);
+ JSObject::UpdateMapCodeCache(stub_holder, name, handler);
return handler;
}
LoadStubCompiler compiler(isolate_);
Handle<Code> handler =
compiler.CompileLoadInterceptor(receiver, holder, name);
- HeapObject::UpdateMapCodeCache(stub_holder, name, handler);
+ JSObject::UpdateMapCodeCache(stub_holder, name, handler);
return handler;
}
LoadStubCompiler compiler(isolate_);
Handle<Code> ic =
compiler.CompileLoadGlobal(receiver, holder, cell, name, is_dont_delete);
- HeapObject::UpdateMapCodeCache(stub_holder, name, ic);
+ JSObject::UpdateMapCodeCache(stub_holder, name, ic);
return ic;
}
KeyedLoadStubCompiler compiler(isolate_);
Handle<Code> handler =
compiler.CompileLoadField(receiver, holder, name, field, representation);
- HeapObject::UpdateMapCodeCache(stub_holder, name, handler);
+ JSObject::UpdateMapCodeCache(stub_holder, name, handler);
return handler;
}
KeyedLoadStubCompiler compiler(isolate_);
handler = compiler.CompileLoadConstant(receiver, holder, name, value);
- HeapObject::UpdateMapCodeCache(stub_holder, name, handler);
+ JSObject::UpdateMapCodeCache(stub_holder, name, handler);
return handler;
}
KeyedLoadStubCompiler compiler(isolate_);
Handle<Code> handler =
compiler.CompileLoadInterceptor(receiver, holder, name);
- HeapObject::UpdateMapCodeCache(stub_holder, name, handler);
+ JSObject::UpdateMapCodeCache(stub_holder, name, handler);
return handler;
}
KeyedLoadStubCompiler compiler(isolate_);
Handle<Code> handler =
compiler.CompileLoadCallback(receiver, holder, name, callback);
- HeapObject::UpdateMapCodeCache(stub_holder, name, handler);
+ JSObject::UpdateMapCodeCache(stub_holder, name, handler);
return handler;
}
KeyedLoadStubCompiler compiler(isolate_);
Handle<Code> handler =
compiler.CompileLoadCallback(receiver, holder, name, call_optimization);
- HeapObject::UpdateMapCodeCache(stub_holder, name, handler);
+ JSObject::UpdateMapCodeCache(stub_holder, name, handler);
return handler;
}
StoreStubCompiler compiler(isolate_, strict_mode);
Handle<Code> handler = compiler.CompileStoreField(receiver, lookup, name);
- HeapObject::UpdateMapCodeCache(receiver, name, handler);
+ JSObject::UpdateMapCodeCache(receiver, name, handler);
return handler;
}
StoreStubCompiler compiler(isolate_, strict_mode);
Handle<Code> handler =
compiler.CompileStoreTransition(receiver, lookup, transition, name);
- HeapObject::UpdateMapCodeCache(receiver, name, handler);
+ JSObject::UpdateMapCodeCache(receiver, name, handler);
return handler;
}
Handle<Map> cell_map(isolate_->heap()->global_property_cell_map());
code->ReplaceNthObject(1, *cell_map, *cell);
- HeapObject::UpdateMapCodeCache(receiver, name, code);
+ JSObject::UpdateMapCodeCache(receiver, name, code);
return code;
}
StoreStubCompiler compiler(isolate_, strict_mode);
Handle<Code> handler = compiler.CompileStoreCallback(
receiver, holder, name, callback);
- HeapObject::UpdateMapCodeCache(receiver, name, handler);
+ JSObject::UpdateMapCodeCache(receiver, name, handler);
return handler;
}
StoreStubCompiler compiler(isolate_, strict_mode);
Handle<Code> handler = compiler.CompileStoreCallback(
receiver, holder, name, call_optimization);
- HeapObject::UpdateMapCodeCache(receiver, name, handler);
+ JSObject::UpdateMapCodeCache(receiver, name, handler);
return handler;
}
StoreStubCompiler compiler(isolate_, strict_mode);
Handle<Code> handler = compiler.CompileStoreViaSetter(
receiver, holder, name, setter);
- HeapObject::UpdateMapCodeCache(receiver, name, handler);
+ JSObject::UpdateMapCodeCache(receiver, name, handler);
return handler;
}
StoreStubCompiler compiler(isolate_, strict_mode);
Handle<Code> handler = compiler.CompileStoreInterceptor(receiver, name);
- HeapObject::UpdateMapCodeCache(receiver, name, handler);
+ JSObject::UpdateMapCodeCache(receiver, name, handler);
return handler;
}
KeyedStoreStubCompiler compiler(isolate(), strict_mode, STANDARD_STORE);
Handle<Code> handler = compiler.CompileStoreField(receiver, lookup, name);
- HeapObject::UpdateMapCodeCache(receiver, name, handler);
+ JSObject::UpdateMapCodeCache(receiver, name, handler);
return handler;
}
KeyedStoreStubCompiler compiler(isolate(), strict_mode, STANDARD_STORE);
Handle<Code> handler =
compiler.CompileStoreTransition(receiver, lookup, transition, name);
- HeapObject::UpdateMapCodeCache(receiver, name, handler);
+ JSObject::UpdateMapCodeCache(receiver, name, handler);
return handler;
}
GDBJIT(AddCode(GDBJITInterface::CALL_IC, *name, *code));
if (CallStubCompiler::CanBeCached(function)) {
- HeapObject::UpdateMapCodeCache(stub_holder, name, code);
+ JSObject::UpdateMapCodeCache(stub_holder, name, code);
}
return code;
}
PROFILE(isolate_,
CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_IC_TAG), *code, *name));
GDBJIT(AddCode(GDBJITInterface::CALL_IC, *name, *code));
- HeapObject::UpdateMapCodeCache(stub_holder, name, code);
+ JSObject::UpdateMapCodeCache(stub_holder, name, code);
return code;
}
PROFILE(isolate(),
CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_IC_TAG), *code, *name));
GDBJIT(AddCode(GDBJITInterface::CALL_IC, *name, *code));
- HeapObject::UpdateMapCodeCache(stub_holder, name, code);
+ JSObject::UpdateMapCodeCache(stub_holder, name, code);
return code;
}
CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_IC_TAG), *code, *name));
GDBJIT(AddCode(GDBJITInterface::CALL_IC, *name, *code));
if (CallStubCompiler::CanBeCached(function)) {
- HeapObject::UpdateMapCodeCache(stub_holder, name, code);
+ JSObject::UpdateMapCodeCache(stub_holder, name, code);
}
return code;
}