Commit feeb0b02 authored by ulan@chromium.org's avatar ulan@chromium.org

Handlify upper layers of LoadIC.

BUG=
TEST=

Review URL: http://codereview.chromium.org/8337008

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9680 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 24bc70b2
......@@ -3093,7 +3093,13 @@ static Local<Value> GetPropertyByLookup(i::Isolate* isolate,
// If the property being looked up is a callback, it can throw
// an exception.
EXCEPTION_PREAMBLE(isolate);
i::Handle<i::Object> result = i::GetProperty(receiver, name, lookup);
PropertyAttributes attributes;
i::Handle<i::Object> result = i::Object::GetProperty(isolate,
receiver,
receiver,
lookup,
name,
&attributes);
has_pending_exception = result.is_null();
EXCEPTION_BAILOUT_CHECK(isolate, Local<Value>());
......
......@@ -376,17 +376,6 @@ Handle<Object> GetProperty(Handle<Object> obj,
}
Handle<Object> GetProperty(Handle<JSReceiver> obj,
Handle<String> name,
LookupResult* result) {
PropertyAttributes attributes;
Isolate* isolate = Isolate::Current();
CALL_HEAP_FUNCTION(isolate,
obj->GetProperty(*obj, result, *name, &attributes),
Object);
}
Handle<Object> GetElement(Handle<Object> obj,
uint32_t index) {
Isolate* isolate = Isolate::Current();
......
......@@ -246,11 +246,6 @@ Handle<Object> GetProperty(Handle<JSReceiver> obj,
Handle<Object> GetProperty(Handle<Object> obj,
Handle<Object> key);
Handle<Object> GetProperty(Handle<JSReceiver> obj,
Handle<String> name,
LookupResult* result);
Handle<Object> GetElement(Handle<Object> obj,
uint32_t index);
......
This diff is collapsed.
......@@ -321,17 +321,15 @@ class LoadIC: public IC {
Handle<String> name);
// Stub accessors.
Code* megamorphic_stub() {
return isolate()->builtins()->builtin(
Builtins::kLoadIC_Megamorphic);
Handle<Code> megamorphic_stub() {
return isolate()->builtins()->LoadIC_Megamorphic();
}
static Code* initialize_stub() {
return Isolate::Current()->builtins()->builtin(
Builtins::kLoadIC_Initialize);
}
Code* pre_monomorphic_stub() {
return isolate()->builtins()->builtin(
Builtins::kLoadIC_PreMonomorphic);
Handle<Code> pre_monomorphic_stub() {
return isolate()->builtins()->LoadIC_PreMonomorphic();
}
static void Clear(Address address, Code* target);
......
......@@ -528,6 +528,19 @@ bool JSObject::IsDirty() {
}
Handle<Object> Object::GetProperty(Isolate* isolate,
Handle<Object> object,
Handle<Object> receiver,
LookupResult* result,
Handle<String> key,
PropertyAttributes* attributes) {
CALL_HEAP_FUNCTION(
isolate,
object->GetProperty(*receiver, result, *key, attributes),
Object);
}
MaybeObject* Object::GetProperty(Object* receiver,
LookupResult* result,
String* name,
......@@ -3117,6 +3130,15 @@ void NormalizedMapCache::Clear() {
}
void JSObject::UpdateMapCodeCache(Isolate* isolate,
Handle<JSObject> object,
Handle<String> name,
Handle<Code> code) {
CALL_HEAP_FUNCTION_VOID(isolate,
object->UpdateMapCodeCache(*name, *code));
}
MaybeObject* JSObject::UpdateMapCodeCache(String* name, Code* code) {
if (map()->is_shared()) {
// Fast case maps are never marked as shared.
......
......@@ -912,10 +912,19 @@ class Object : public MaybeObject {
Object* receiver,
String* key,
PropertyAttributes* attributes);
static Handle<Object> GetProperty(Isolate* isolate,
Handle<Object> object,
Handle<Object> receiver,
LookupResult* result,
Handle<String> key,
PropertyAttributes* attributes);
MUST_USE_RESULT MaybeObject* GetProperty(Object* receiver,
LookupResult* result,
String* key,
PropertyAttributes* attributes);
MUST_USE_RESULT MaybeObject* GetPropertyWithDefinedGetter(Object* receiver,
JSReceiver* getter);
......@@ -1835,6 +1844,11 @@ class JSObject: public JSReceiver {
// dictionary. Returns the backing after conversion.
MUST_USE_RESULT MaybeObject* NormalizeElements();
static void UpdateMapCodeCache(Isolate* isolate,
Handle<JSObject> object,
Handle<String> name,
Handle<Code> code);
MUST_USE_RESULT MaybeObject* UpdateMapCodeCache(String* name, Code* code);
// Transform slow named properties to fast variants.
......
......@@ -8069,7 +8069,8 @@ static void TrySettingInlineConstructStub(Isolate* isolate,
prototype = Handle<Object>(function->instance_prototype(), isolate);
}
if (function->shared()->CanGenerateInlineConstructor(*prototype)) {
ConstructStubCompiler compiler;
HandleScope scope(isolate);
ConstructStubCompiler compiler(isolate);
MaybeObject* code = compiler.CompileConstructStub(*function);
if (!code->IsFailure()) {
function->shared()->set_construct_stub(
......
This diff is collapsed.
......@@ -76,41 +76,35 @@ class StubCache {
// Computes the right stub matching. Inserts the result in the
// cache before returning. This might compile a stub if needed.
MUST_USE_RESULT MaybeObject* ComputeLoadNonexistent(
String* name,
JSObject* receiver);
MUST_USE_RESULT MaybeObject* ComputeLoadField(String* name,
JSObject* receiver,
JSObject* holder,
int field_index);
MUST_USE_RESULT MaybeObject* ComputeLoadCallback(
String* name,
JSObject* receiver,
JSObject* holder,
AccessorInfo* callback);
Handle<Code> ComputeLoadNonexistent(Handle<String> name,
Handle<JSObject> receiver);
MUST_USE_RESULT MaybeObject* ComputeLoadConstant(String* name,
JSObject* receiver,
JSObject* holder,
Object* value);
Handle<Code> ComputeLoadField(Handle<String> name,
Handle<JSObject> receiver,
Handle<JSObject> holder,
int field_index);
MUST_USE_RESULT MaybeObject* ComputeLoadInterceptor(
String* name,
JSObject* receiver,
JSObject* holder);
Handle<Code> ComputeLoadCallback(Handle<String> name,
Handle<JSObject> receiver,
Handle<JSObject> holder,
Handle<AccessorInfo> callback);
MUST_USE_RESULT MaybeObject* ComputeLoadNormal();
Handle<Code> ComputeLoadConstant(Handle<String> name,
Handle<JSObject> receiver,
Handle<JSObject> holder,
Handle<Object> value);
Handle<Code> ComputeLoadInterceptor(Handle<String> name,
Handle<JSObject> receiver,
Handle<JSObject> holder);
MUST_USE_RESULT MaybeObject* ComputeLoadGlobal(
String* name,
JSObject* receiver,
GlobalObject* holder,
JSGlobalPropertyCell* cell,
bool is_dont_delete);
Handle<Code> ComputeLoadNormal();
Handle<Code> ComputeLoadGlobal(Handle<String> name,
Handle<JSObject> receiver,
Handle<GlobalObject> holder,
Handle<JSGlobalPropertyCell> cell,
bool is_dont_delete);
// ---
......@@ -330,6 +324,7 @@ class StubCache {
Isolate* isolate() { return isolate_; }
Heap* heap() { return isolate()->heap(); }
Factory* factory() { return isolate()->factory(); }
private:
explicit StubCache(Isolate* isolate);
......@@ -410,8 +405,8 @@ DECLARE_RUNTIME_FUNCTION(MaybeObject*, KeyedLoadPropertyWithInterceptor);
// The stub compiler compiles stubs for the stub cache.
class StubCompiler BASE_EMBEDDED {
public:
StubCompiler()
: scope_(), masm_(Isolate::Current(), NULL, 256), failure_(NULL) { }
explicit StubCompiler(Isolate* isolate)
: isolate_(isolate), masm_(isolate, NULL, 256), failure_(NULL) { }
MUST_USE_RESULT MaybeObject* CompileCallInitialize(Code::Flags flags);
MUST_USE_RESULT MaybeObject* CompileCallPreMonomorphic(Code::Flags flags);
......@@ -567,12 +562,12 @@ class StubCompiler BASE_EMBEDDED {
String* name,
LookupResult* lookup);
Isolate* isolate() { return scope_.isolate(); }
Isolate* isolate() { return isolate_; }
Heap* heap() { return isolate()->heap(); }
Factory* factory() { return isolate()->factory(); }
private:
HandleScope scope_;
Isolate* isolate_;
MacroAssembler masm_;
Failure* failure_;
};
......@@ -580,29 +575,60 @@ class StubCompiler BASE_EMBEDDED {
class LoadStubCompiler: public StubCompiler {
public:
explicit LoadStubCompiler(Isolate* isolate) : StubCompiler(isolate) { }
Handle<Code> CompileLoadNonexistent(Handle<String> name,
Handle<JSObject> object,
Handle<JSObject> last);
MUST_USE_RESULT MaybeObject* CompileLoadNonexistent(String* name,
JSObject* object,
JSObject* last);
Handle<Code> CompileLoadField(Handle<JSObject> object,
Handle<JSObject> holder,
int index,
Handle<String> name);
MUST_USE_RESULT MaybeObject* CompileLoadField(JSObject* object,
JSObject* holder,
int index,
String* name);
Handle<Code> CompileLoadCallback(Handle<String> name,
Handle<JSObject> object,
Handle<JSObject> holder,
Handle<AccessorInfo> callback);
MUST_USE_RESULT MaybeObject* CompileLoadCallback(String* name,
JSObject* object,
JSObject* holder,
AccessorInfo* callback);
Handle<Code> CompileLoadConstant(Handle<JSObject> object,
Handle<JSObject> holder,
Handle<Object> value,
Handle<String> name);
MUST_USE_RESULT MaybeObject* CompileLoadConstant(JSObject* object,
JSObject* holder,
Object* value,
String* name);
Handle<Code> CompileLoadInterceptor(Handle<JSObject> object,
Handle<JSObject> holder,
Handle<String> name);
MUST_USE_RESULT MaybeObject* CompileLoadInterceptor(JSObject* object,
JSObject* holder,
String* name);
Handle<Code> CompileLoadGlobal(Handle<JSObject> object,
Handle<GlobalObject> holder,
Handle<JSGlobalPropertyCell> cell,
Handle<String> name,
bool is_dont_delete);
MUST_USE_RESULT MaybeObject* CompileLoadGlobal(JSObject* object,
GlobalObject* holder,
JSGlobalPropertyCell* cell,
......@@ -616,6 +642,7 @@ class LoadStubCompiler: public StubCompiler {
class KeyedLoadStubCompiler: public StubCompiler {
public:
explicit KeyedLoadStubCompiler(Isolate* isolate) : StubCompiler(isolate) { }
MUST_USE_RESULT MaybeObject* CompileLoadField(String* name,
JSObject* object,
JSObject* holder,
......@@ -663,8 +690,8 @@ class KeyedLoadStubCompiler: public StubCompiler {
class StoreStubCompiler: public StubCompiler {
public:
explicit StoreStubCompiler(StrictModeFlag strict_mode)
: strict_mode_(strict_mode) { }
StoreStubCompiler(Isolate* isolate, StrictModeFlag strict_mode)
: StubCompiler(isolate), strict_mode_(strict_mode) { }
MUST_USE_RESULT MaybeObject* CompileStoreField(JSObject* object,
int index,
......@@ -690,8 +717,8 @@ class StoreStubCompiler: public StubCompiler {
class KeyedStoreStubCompiler: public StubCompiler {
public:
explicit KeyedStoreStubCompiler(StrictModeFlag strict_mode)
: strict_mode_(strict_mode) { }
KeyedStoreStubCompiler(Isolate* isolate, StrictModeFlag strict_mode)
: StubCompiler(isolate), strict_mode_(strict_mode) { }
MUST_USE_RESULT MaybeObject* CompileStoreField(JSObject* object,
int index,
......@@ -742,7 +769,8 @@ class CallOptimization;
class CallStubCompiler: public StubCompiler {
public:
CallStubCompiler(int argc,
CallStubCompiler(Isolate* isolate,
int argc,
Code::Kind kind,
Code::ExtraICState extra_ic_state,
InlineCacheHolderFlag cache_holder);
......@@ -835,7 +863,7 @@ class CallStubCompiler: public StubCompiler {
class ConstructStubCompiler: public StubCompiler {
public:
explicit ConstructStubCompiler() {}
explicit ConstructStubCompiler(Isolate* isolate) : StubCompiler(isolate) { }
MUST_USE_RESULT MaybeObject* CompileConstructStub(JSFunction* function);
......
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