Commit 90cecd65 authored by verwaest@chromium.org's avatar verwaest@chromium.org

Only use Type for compiling load handlers.

BUG=
R=ishell@chromium.org

Review URL: https://chromiumcodereview.appspot.com/80693002

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@18025 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 016113d9
......@@ -1308,14 +1308,14 @@ void StoreStubCompiler::HandlerFrontendFooter(Handle<Name> name, Label* miss) {
Register LoadStubCompiler::CallbackHandlerFrontend(
Handle<Object> object,
Handle<Type> type,
Register object_reg,
Handle<JSObject> holder,
Handle<Name> name,
Handle<Object> callback) {
Label miss;
Register reg = HandlerFrontendHeader(object, object_reg, holder, name, &miss);
Register reg = HandlerFrontendHeader(type, object_reg, holder, name, &miss);
if (!holder->HasFastProperties() && !holder->IsJSGlobalObject()) {
ASSERT(!reg.is(scratch2()));
......@@ -2800,7 +2800,8 @@ Handle<Code> StoreStubCompiler::CompileStoreCallback(
Handle<JSObject> holder,
Handle<Name> name,
Handle<ExecutableAccessorInfo> callback) {
HandlerFrontend(object, receiver(), holder, name);
HandlerFrontend(IC::CurrentTypeOf(object, isolate()),
receiver(), holder, name);
// Stub never generated for non-global objects that require access checks.
ASSERT(holder->IsJSGlobalProxy() || !holder->IsAccessCheckNeeded());
......@@ -2826,7 +2827,8 @@ Handle<Code> StoreStubCompiler::CompileStoreCallback(
Handle<JSObject> holder,
Handle<Name> name,
const CallOptimization& call_optimization) {
HandlerFrontend(object, receiver(), holder, name);
HandlerFrontend(IC::CurrentTypeOf(object, isolate()),
receiver(), holder, name);
Register values[] = { value() };
GenerateFastApiCall(
......@@ -2920,12 +2922,10 @@ Handle<Code> StoreStubCompiler::CompileStoreInterceptor(
}
Handle<Code> LoadStubCompiler::CompileLoadNonexistent(
Handle<Object> object,
Handle<JSObject> last,
Handle<Name> name,
Handle<JSGlobalObject> global) {
NonexistentHandlerFrontend(object, last, name, global);
Handle<Code> LoadStubCompiler::CompileLoadNonexistent(Handle<Type> type,
Handle<JSObject> last,
Handle<Name> name) {
NonexistentHandlerFrontend(type, last, name);
// Return undefined if maps of the full prototype chain are still the
// same and no global property with this name contains a value.
......@@ -3021,14 +3021,14 @@ void LoadStubCompiler::GenerateLoadViaGetter(MacroAssembler* masm,
Handle<Code> LoadStubCompiler::CompileLoadGlobal(
Handle<Object> object,
Handle<Type> type,
Handle<GlobalObject> global,
Handle<PropertyCell> cell,
Handle<Name> name,
bool is_dont_delete) {
Label miss;
HandlerFrontendHeader(object, receiver(), global, name, &miss);
HandlerFrontendHeader(type, receiver(), global, name, &miss);
// Get the value from the cell.
__ mov(r3, Operand(cell));
......
......@@ -1342,14 +1342,14 @@ void StoreStubCompiler::HandlerFrontendFooter(Handle<Name> name, Label* miss) {
Register LoadStubCompiler::CallbackHandlerFrontend(
Handle<Object> object,
Handle<Type> type,
Register object_reg,
Handle<JSObject> holder,
Handle<Name> name,
Handle<Object> callback) {
Label miss;
Register reg = HandlerFrontendHeader(object, object_reg, holder, name, &miss);
Register reg = HandlerFrontendHeader(type, object_reg, holder, name, &miss);
if (!holder->HasFastProperties() && !holder->IsJSGlobalObject()) {
ASSERT(!reg.is(scratch2()));
......@@ -2952,7 +2952,8 @@ Handle<Code> StoreStubCompiler::CompileStoreCallback(
Handle<JSObject> holder,
Handle<Name> name,
Handle<ExecutableAccessorInfo> callback) {
HandlerFrontend(object, receiver(), holder, name);
HandlerFrontend(IC::CurrentTypeOf(object, isolate()),
receiver(), holder, name);
__ pop(scratch1()); // remove the return address
__ push(receiver());
......@@ -2976,7 +2977,8 @@ Handle<Code> StoreStubCompiler::CompileStoreCallback(
Handle<JSObject> holder,
Handle<Name> name,
const CallOptimization& call_optimization) {
HandlerFrontend(object, receiver(), holder, name);
HandlerFrontend(IC::CurrentTypeOf(object, isolate()),
receiver(), holder, name);
Register values[] = { value() };
GenerateFastApiCall(
......@@ -3083,12 +3085,10 @@ Handle<Code> KeyedStoreStubCompiler::CompileStorePolymorphic(
}
Handle<Code> LoadStubCompiler::CompileLoadNonexistent(
Handle<Object> object,
Handle<JSObject> last,
Handle<Name> name,
Handle<JSGlobalObject> global) {
NonexistentHandlerFrontend(object, last, name, global);
Handle<Code> LoadStubCompiler::CompileLoadNonexistent(Handle<Type> type,
Handle<JSObject> last,
Handle<Name> name) {
NonexistentHandlerFrontend(type, last, name);
// Return undefined if maps of the full prototype chain are still the
// same and no global property with this name contains a value.
......@@ -3179,14 +3179,14 @@ void LoadStubCompiler::GenerateLoadViaGetter(MacroAssembler* masm,
Handle<Code> LoadStubCompiler::CompileLoadGlobal(
Handle<Object> object,
Handle<Type> type,
Handle<GlobalObject> global,
Handle<PropertyCell> cell,
Handle<Name> name,
bool is_dont_delete) {
Label miss;
HandlerFrontendHeader(object, receiver(), global, name, &miss);
HandlerFrontendHeader(type, receiver(), global, name, &miss);
// Get the value from the cell.
if (Serializer::enabled()) {
__ mov(eax, Immediate(cell));
......
......@@ -1145,13 +1145,14 @@ void LoadIC::UpdateCaches(LookupResult* lookup,
return;
}
Handle<Type> type = CurrentTypeOf(object, isolate());
Handle<Code> code;
if (!lookup->IsCacheable()) {
// Bail out if the result is not cacheable.
code = slow_stub();
} else if (!lookup->IsProperty()) {
if (kind() == Code::LOAD_IC) {
code = isolate()->stub_cache()->ComputeLoadNonexistent(name, object);
code = isolate()->stub_cache()->ComputeLoadNonexistent(name, type);
} else {
code = slow_stub();
}
......@@ -1159,7 +1160,7 @@ void LoadIC::UpdateCaches(LookupResult* lookup,
code = ComputeHandler(lookup, object, name);
}
PatchCache(CurrentTypeOf(object, isolate()), name, code);
PatchCache(type, name, code);
TRACE_IC("LoadIC", name);
}
......@@ -1181,7 +1182,7 @@ Handle<Code> IC::ComputeHandler(LookupResult* lookup,
isolate(), *object, cache_holder));
Handle<Code> code = isolate()->stub_cache()->FindHandler(
name, stub_holder, kind(), cache_holder, strict_mode());
name, handle(stub_holder->map()), kind(), cache_holder, strict_mode());
if (!code.is_null()) return code;
code = CompileHandler(lookup, object, name, value, cache_holder);
......@@ -1205,6 +1206,7 @@ Handle<Code> LoadIC::CompileHandler(LookupResult* lookup,
return SimpleFieldLoad(length_index);
}
Handle<Type> type = CurrentTypeOf(object, isolate());
Handle<JSObject> holder(lookup->holder());
LoadStubCompiler compiler(isolate(), cache_holder, kind());
......@@ -1217,14 +1219,14 @@ Handle<Code> LoadIC::CompileHandler(LookupResult* lookup,
lookup->representation());
}
return compiler.CompileLoadField(
object, holder, name, field, lookup->representation());
type, holder, name, field, lookup->representation());
}
case CONSTANT: {
Handle<Object> constant(lookup->GetConstant(), isolate());
// TODO(2803): Don't compute a stub for cons strings because they cannot
// be embedded into code.
if (constant->IsConsString()) break;
return compiler.CompileLoadConstant(object, holder, name, constant);
return compiler.CompileLoadConstant(type, holder, name, constant);
}
case NORMAL:
if (kind() != Code::LOAD_IC) break;
......@@ -1233,7 +1235,7 @@ Handle<Code> LoadIC::CompileHandler(LookupResult* lookup,
Handle<PropertyCell> cell(
global->GetPropertyCell(lookup), isolate());
Handle<Code> code = compiler.CompileLoadGlobal(
object, global, cell, name, lookup->IsDontDelete());
type, global, cell, name, lookup->IsDontDelete());
// TODO(verwaest): Move caching of these NORMAL stubs outside as well.
Handle<HeapObject> stub_holder(GetCodeCacheHolder(
isolate(), *object, cache_holder));
......@@ -1263,7 +1265,7 @@ Handle<Code> LoadIC::CompileHandler(LookupResult* lookup,
Handle<ExecutableAccessorInfo>::cast(callback);
if (v8::ToCData<Address>(info->getter()) == 0) break;
if (!info->IsCompatibleReceiver(*object)) break;
return compiler.CompileLoadCallback(object, holder, name, info);
return compiler.CompileLoadCallback(type, holder, name, info);
} else if (callback->IsAccessorPair()) {
Handle<Object> getter(Handle<AccessorPair>::cast(callback)->getter(),
isolate());
......@@ -1282,9 +1284,9 @@ Handle<Code> LoadIC::CompileHandler(LookupResult* lookup,
if (call_optimization.is_simple_api_call() &&
call_optimization.IsCompatibleReceiver(*object)) {
return compiler.CompileLoadCallback(
object, holder, name, call_optimization);
type, holder, name, call_optimization);
}
return compiler.CompileLoadViaGetter(object, holder, name, function);
return compiler.CompileLoadViaGetter(type, holder, name, function);
}
// TODO(dcarney): Handle correctly.
if (callback->IsDeclaredAccessorInfo()) break;
......@@ -1294,7 +1296,7 @@ Handle<Code> LoadIC::CompileHandler(LookupResult* lookup,
}
case INTERCEPTOR:
ASSERT(HasInterceptorGetter(*holder));
return compiler.CompileLoadInterceptor(object, holder, name);
return compiler.CompileLoadInterceptor(type, holder, name);
default:
break;
}
......
This diff is collapsed.
......@@ -87,7 +87,7 @@ class StubCache {
InlineCacheHolderFlag cache_holder = OWN_MAP);
Handle<Code> FindHandler(Handle<Name> name,
Handle<HeapObject> stub_holder,
Handle<Map> map,
Code::Kind kind,
InlineCacheHolderFlag cache_holder = OWN_MAP,
StrictModeFlag strict_mode = kNonStrictMode);
......@@ -97,7 +97,7 @@ class StubCache {
Handle<Code> handler,
StrictModeFlag strict_mode);
Handle<Code> ComputeLoadNonexistent(Handle<Name> name, Handle<Object> object);
Handle<Code> ComputeLoadNonexistent(Handle<Name> name, Handle<Type> type);
Handle<Code> ComputeKeyedLoadElement(Handle<Map> receiver_map);
......@@ -549,7 +549,7 @@ class BaseLoadStoreStubCompiler: public StubCompiler {
}
protected:
virtual Register HandlerFrontendHeader(Handle<Object> object,
virtual Register HandlerFrontendHeader(Handle<Type> type,
Register object_reg,
Handle<JSObject> holder,
Handle<Name> name,
......@@ -557,7 +557,7 @@ class BaseLoadStoreStubCompiler: public StubCompiler {
virtual void HandlerFrontendFooter(Handle<Name> name, Label* miss) = 0;
Register HandlerFrontend(Handle<Object> object,
Register HandlerFrontend(Handle<Type> type,
Register object_reg,
Handle<JSObject> holder,
Handle<Name> name);
......@@ -615,32 +615,32 @@ class LoadStubCompiler: public BaseLoadStoreStubCompiler {
: BaseLoadStoreStubCompiler(isolate, kind, cache_holder) { }
virtual ~LoadStubCompiler() { }
Handle<Code> CompileLoadField(Handle<Object> object,
Handle<Code> CompileLoadField(Handle<Type> type,
Handle<JSObject> holder,
Handle<Name> name,
PropertyIndex index,
Representation representation);
Handle<Code> CompileLoadCallback(Handle<Object> object,
Handle<Code> CompileLoadCallback(Handle<Type> type,
Handle<JSObject> holder,
Handle<Name> name,
Handle<ExecutableAccessorInfo> callback);
Handle<Code> CompileLoadCallback(Handle<Object> object,
Handle<Code> CompileLoadCallback(Handle<Type> type,
Handle<JSObject> holder,
Handle<Name> name,
const CallOptimization& call_optimization);
Handle<Code> CompileLoadConstant(Handle<Object> object,
Handle<Code> CompileLoadConstant(Handle<Type> type,
Handle<JSObject> holder,
Handle<Name> name,
Handle<Object> value);
Handle<Code> CompileLoadInterceptor(Handle<Object> object,
Handle<Code> CompileLoadInterceptor(Handle<Type> type,
Handle<JSObject> holder,
Handle<Name> name);
Handle<Code> CompileLoadViaGetter(Handle<Object> object,
Handle<Code> CompileLoadViaGetter(Handle<Type> type,
Handle<JSObject> holder,
Handle<Name> name,
Handle<JSFunction> getter);
......@@ -649,12 +649,11 @@ class LoadStubCompiler: public BaseLoadStoreStubCompiler {
Register receiver,
Handle<JSFunction> getter);
Handle<Code> CompileLoadNonexistent(Handle<Object> object,
Handle<Code> CompileLoadNonexistent(Handle<Type> type,
Handle<JSObject> last,
Handle<Name> name,
Handle<JSGlobalObject> global);
Handle<Name> name);
Handle<Code> CompileLoadGlobal(Handle<Object> object,
Handle<Code> CompileLoadGlobal(Handle<Type> type,
Handle<GlobalObject> holder,
Handle<PropertyCell> cell,
Handle<Name> name,
......@@ -663,7 +662,7 @@ class LoadStubCompiler: public BaseLoadStoreStubCompiler {
static Register* registers();
protected:
virtual Register HandlerFrontendHeader(Handle<Object> object,
virtual Register HandlerFrontendHeader(Handle<Type> type,
Register object_reg,
Handle<JSObject> holder,
Handle<Name> name,
......@@ -671,15 +670,14 @@ class LoadStubCompiler: public BaseLoadStoreStubCompiler {
virtual void HandlerFrontendFooter(Handle<Name> name, Label* miss);
Register CallbackHandlerFrontend(Handle<Object> object,
Register CallbackHandlerFrontend(Handle<Type> type,
Register object_reg,
Handle<JSObject> holder,
Handle<Name> name,
Handle<Object> callback);
void NonexistentHandlerFrontend(Handle<Object> object,
void NonexistentHandlerFrontend(Handle<Type> type,
Handle<JSObject> last,
Handle<Name> name,
Handle<JSGlobalObject> global);
Handle<Name> name);
void GenerateLoadField(Register reg,
Handle<JSObject> holder,
......@@ -812,7 +810,7 @@ class StoreStubCompiler: public BaseLoadStoreStubCompiler {
}
protected:
virtual Register HandlerFrontendHeader(Handle<Object> object,
virtual Register HandlerFrontendHeader(Handle<Type> type,
Register object_reg,
Handle<JSObject> holder,
Handle<Name> name,
......
......@@ -1284,14 +1284,14 @@ void StoreStubCompiler::HandlerFrontendFooter(Handle<Name> name, Label* miss) {
Register LoadStubCompiler::CallbackHandlerFrontend(
Handle<Object> object,
Handle<Type> type,
Register object_reg,
Handle<JSObject> holder,
Handle<Name> name,
Handle<Object> callback) {
Label miss;
Register reg = HandlerFrontendHeader(object, object_reg, holder, name, &miss);
Register reg = HandlerFrontendHeader(type, object_reg, holder, name, &miss);
if (!holder->HasFastProperties() && !holder->IsJSGlobalObject()) {
ASSERT(!reg.is(scratch2()));
......@@ -2862,7 +2862,8 @@ Handle<Code> StoreStubCompiler::CompileStoreCallback(
Handle<JSObject> holder,
Handle<Name> name,
Handle<ExecutableAccessorInfo> callback) {
HandlerFrontend(object, receiver(), holder, name);
HandlerFrontend(IC::CurrentTypeOf(object, isolate()),
receiver(), holder, name);
__ PopReturnAddressTo(scratch1());
__ push(receiver());
......@@ -2886,7 +2887,8 @@ Handle<Code> StoreStubCompiler::CompileStoreCallback(
Handle<JSObject> holder,
Handle<Name> name,
const CallOptimization& call_optimization) {
HandlerFrontend(object, receiver(), holder, name);
HandlerFrontend(IC::CurrentTypeOf(object, isolate()),
receiver(), holder, name);
Register values[] = { value() };
GenerateFastApiCall(
......@@ -3000,12 +3002,10 @@ Handle<Code> KeyedStoreStubCompiler::CompileStorePolymorphic(
}
Handle<Code> LoadStubCompiler::CompileLoadNonexistent(
Handle<Object> object,
Handle<JSObject> last,
Handle<Name> name,
Handle<JSGlobalObject> global) {
NonexistentHandlerFrontend(object, last, name, global);
Handle<Code> LoadStubCompiler::CompileLoadNonexistent(Handle<Type> type,
Handle<JSObject> last,
Handle<Name> name) {
NonexistentHandlerFrontend(type, last, name);
// Return undefined if maps of the full prototype chain are still the
// same and no global property with this name contains a value.
......@@ -3101,7 +3101,7 @@ void LoadStubCompiler::GenerateLoadViaGetter(MacroAssembler* masm,
Handle<Code> LoadStubCompiler::CompileLoadGlobal(
Handle<Object> object,
Handle<Type> type,
Handle<GlobalObject> global,
Handle<PropertyCell> cell,
Handle<Name> name,
......@@ -3110,7 +3110,7 @@ Handle<Code> LoadStubCompiler::CompileLoadGlobal(
// TODO(verwaest): Directly store to rax. Currently we cannot do this, since
// rax is used as receiver(), which we would otherwise clobber before a
// potential miss.
HandlerFrontendHeader(object, receiver(), global, name, &miss);
HandlerFrontendHeader(type, receiver(), global, name, &miss);
// Get the value from the cell.
__ Move(rbx, cell);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment