| Index: src/ic.cc
|
| diff --git a/src/ic.cc b/src/ic.cc
|
| index a6ffb13ad40a84b16073b7d6b8a4bbb43ab7e702..67910650a3b0c06d795732abcd5c7d3c98d90abe 100644
|
| --- a/src/ic.cc
|
| +++ b/src/ic.cc
|
| @@ -766,12 +766,13 @@ void CallICBase::UpdateCaches(LookupResult* lookup,
|
| // Bail out if we didn't find a result.
|
| if (!lookup->IsProperty() || !lookup->IsCacheable()) return;
|
|
|
| - // Compute the number of arguments.
|
| - Handle<Code> code;
|
| - code = state() == UNINITIALIZED
|
| - ? pre_monomorphic_stub()
|
| - : ComputeMonomorphicStub(lookup, object, name);
|
| + if (state() == UNINITIALIZED) {
|
| + set_target(*pre_monomorphic_stub());
|
| + TRACE_IC("CallIC", name);
|
| + return;
|
| + }
|
|
|
| + Handle<Code> code = ComputeMonomorphicStub(lookup, object, name);
|
| // If there's no appropriate stub we simply avoid updating the caches.
|
| // TODO(verwaest): Install a slow fallback in this case to avoid not learning,
|
| // and deopting Crankshaft code.
|
| @@ -952,7 +953,6 @@ bool IC::UpdatePolymorphicIC(Handle<HeapObject> receiver,
|
| Handle<String> name,
|
| Handle<Code> code) {
|
| if (!code->is_handler()) return false;
|
| -
|
| MapHandleList receiver_maps;
|
| CodeHandleList handlers;
|
|
|
| @@ -1131,7 +1131,9 @@ void LoadIC::UpdateCaches(LookupResult* lookup,
|
| // 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();
|
| + set_target(*pre_monomorphic_stub());
|
| + TRACE_IC("LoadIC", name);
|
| + return;
|
| } else if (!lookup->IsCacheable()) {
|
| // Bail out if the result is not cacheable.
|
| code = slow_stub();
|
| @@ -1173,8 +1175,9 @@ Handle<Code> IC::ComputeHandler(LookupResult* lookup,
|
| if (!code.is_null()) return code;
|
|
|
| code = CompileHandler(lookup, receiver, name, value);
|
| + ASSERT(code->is_handler());
|
|
|
| - if (code->is_handler() && code->type() != Code::NORMAL) {
|
| + if (code->type() != Code::NORMAL) {
|
| HeapObject::UpdateMapCodeCache(receiver, name, code);
|
| }
|
|
|
| @@ -1213,9 +1216,11 @@ Handle<Code> LoadIC::CompileHandler(LookupResult* lookup,
|
| Handle<GlobalObject> global = Handle<GlobalObject>::cast(holder);
|
| Handle<PropertyCell> cell(
|
| global->GetPropertyCell(lookup), isolate());
|
| - // TODO(verwaest): Turn into a handler.
|
| - return isolate()->stub_cache()->ComputeLoadGlobal(
|
| - name, receiver, global, cell, lookup->IsDontDelete());
|
| + Handle<Code> code = compiler.CompileLoadGlobal(
|
| + receiver, global, cell, name, lookup->IsDontDelete());
|
| + // TODO(verwaest): Move caching of these NORMAL stubs outside as well.
|
| + HeapObject::UpdateMapCodeCache(receiver, name, code);
|
| + return code;
|
| }
|
| // There is only one shared stub for loading normalized
|
| // properties. It does not traverse the prototype chain, so the
|
| @@ -1624,11 +1629,16 @@ Handle<Code> StoreIC::CompileHandler(LookupResult* lookup,
|
| // from the property cell. So the property must be directly on the
|
| // global object.
|
| Handle<GlobalObject> global = Handle<GlobalObject>::cast(receiver);
|
| - Handle<PropertyCell> cell(
|
| - global->GetPropertyCell(lookup), isolate());
|
| - // TODO(verwaest): Turn into a handler.
|
| - return isolate()->stub_cache()->ComputeStoreGlobal(
|
| - name, global, cell, value, strict_mode());
|
| + Handle<PropertyCell> cell(global->GetPropertyCell(lookup), isolate());
|
| + Handle<Type> union_type(PropertyCell::UpdateType(cell, value),
|
| + isolate());
|
| + StoreGlobalStub stub(strict_mode(), union_type->IsConstant());
|
| +
|
| + Handle<Code> code = stub.GetCodeCopyFromTemplate(
|
| + isolate(), receiver->map(), *cell);
|
| + // TODO(verwaest): Move caching of these NORMAL stubs outside as well.
|
| + HeapObject::UpdateMapCodeCache(receiver, name, code);
|
| + return code;
|
| }
|
| ASSERT(holder.is_identical_to(receiver));
|
| return strict_mode() == kStrictMode
|
|
|