Handlification in ic.cc
R=yangguo@chromium.org Review URL: https://codereview.chromium.org/235453010 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@20720 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
8eaff70bed
commit
ae06768ef0
288
src/ic.cc
288
src/ic.cc
@ -375,22 +375,22 @@ void IC::UpdateState(Handle<Object> receiver, Handle<Object> name) {
|
||||
}
|
||||
|
||||
|
||||
Failure* IC::TypeError(const char* type,
|
||||
Handle<Object> object,
|
||||
Handle<Object> key) {
|
||||
MaybeHandle<Object> IC::TypeError(const char* type,
|
||||
Handle<Object> object,
|
||||
Handle<Object> key) {
|
||||
HandleScope scope(isolate());
|
||||
Handle<Object> args[2] = { key, object };
|
||||
Handle<Object> error = isolate()->factory()->NewTypeError(
|
||||
type, HandleVector(args, 2));
|
||||
return isolate()->Throw(*error);
|
||||
return isolate()->Throw<Object>(error);
|
||||
}
|
||||
|
||||
|
||||
Failure* IC::ReferenceError(const char* type, Handle<String> name) {
|
||||
MaybeHandle<Object> IC::ReferenceError(const char* type, Handle<String> name) {
|
||||
HandleScope scope(isolate());
|
||||
Handle<Object> error = isolate()->factory()->NewReferenceError(
|
||||
type, HandleVector(&name, 1));
|
||||
return isolate()->Throw(*error);
|
||||
return isolate()->Throw<Object>(error);
|
||||
}
|
||||
|
||||
|
||||
@ -572,8 +572,7 @@ static bool MigrateDeprecated(Handle<Object> object) {
|
||||
}
|
||||
|
||||
|
||||
MaybeObject* LoadIC::Load(Handle<Object> object,
|
||||
Handle<String> name) {
|
||||
MaybeHandle<Object> LoadIC::Load(Handle<Object> object, Handle<String> name) {
|
||||
// If the object is undefined or null it's illegal to try to get any
|
||||
// of its properties; throw a TypeError in that case.
|
||||
if (object->IsUndefined() || object->IsNull()) {
|
||||
@ -599,7 +598,7 @@ MaybeObject* LoadIC::Load(Handle<Object> object,
|
||||
set_target(*stub);
|
||||
if (FLAG_trace_ic) PrintF("[LoadIC : +#prototype /function]\n");
|
||||
}
|
||||
return *Accessors::FunctionGetPrototype(Handle<JSFunction>::cast(object));
|
||||
return Accessors::FunctionGetPrototype(Handle<JSFunction>::cast(object));
|
||||
}
|
||||
}
|
||||
|
||||
@ -610,10 +609,12 @@ MaybeObject* LoadIC::Load(Handle<Object> object,
|
||||
// Rewrite to the generic keyed load stub.
|
||||
if (FLAG_use_ic) set_target(*generic_stub());
|
||||
Handle<Object> result;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
|
||||
isolate(), result,
|
||||
Runtime::GetElementOrCharAt(isolate(), object, index));
|
||||
return *result;
|
||||
ASSIGN_RETURN_ON_EXCEPTION(
|
||||
isolate(),
|
||||
result,
|
||||
Runtime::GetElementOrCharAt(isolate(), object, index),
|
||||
Object);
|
||||
return result;
|
||||
}
|
||||
|
||||
bool use_ic = MigrateDeprecated(object) ? false : FLAG_use_ic;
|
||||
@ -636,16 +637,18 @@ MaybeObject* LoadIC::Load(Handle<Object> object,
|
||||
PropertyAttributes attr;
|
||||
// Get the property.
|
||||
Handle<Object> result;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
|
||||
isolate(), result,
|
||||
Object::GetProperty(object, object, &lookup, name, &attr));
|
||||
ASSIGN_RETURN_ON_EXCEPTION(
|
||||
isolate(),
|
||||
result,
|
||||
Object::GetProperty(object, object, &lookup, name, &attr),
|
||||
Object);
|
||||
// If the property is not present, check if we need to throw an exception.
|
||||
if ((lookup.IsInterceptor() || lookup.IsHandler()) &&
|
||||
attr == ABSENT && IsUndeclaredGlobal(object)) {
|
||||
return ReferenceError("not_defined", name);
|
||||
}
|
||||
|
||||
return *result;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@ -1121,15 +1124,19 @@ Handle<Code> KeyedLoadIC::LoadElementStub(Handle<JSObject> receiver) {
|
||||
}
|
||||
|
||||
|
||||
MaybeObject* KeyedLoadIC::Load(Handle<Object> object, Handle<Object> key) {
|
||||
MaybeHandle<Object> KeyedLoadIC::Load(Handle<Object> object,
|
||||
Handle<Object> key) {
|
||||
if (MigrateDeprecated(object)) {
|
||||
Handle<Object> result;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
|
||||
isolate(), result, Runtime::GetObjectProperty(isolate(), object, key));
|
||||
return *result;
|
||||
ASSIGN_RETURN_ON_EXCEPTION(
|
||||
isolate(),
|
||||
result,
|
||||
Runtime::GetObjectProperty(isolate(), object, key),
|
||||
Object);
|
||||
return result;
|
||||
}
|
||||
|
||||
MaybeObject* maybe_object = NULL;
|
||||
Handle<Object> load_handle;
|
||||
Handle<Code> stub = generic_stub();
|
||||
|
||||
// Check for non-string values that can be converted into an
|
||||
@ -1137,8 +1144,11 @@ MaybeObject* KeyedLoadIC::Load(Handle<Object> object, Handle<Object> key) {
|
||||
key = TryConvertKey(key, isolate());
|
||||
|
||||
if (key->IsInternalizedString()) {
|
||||
maybe_object = LoadIC::Load(object, Handle<String>::cast(key));
|
||||
if (maybe_object->IsFailure()) return maybe_object;
|
||||
ASSIGN_RETURN_ON_EXCEPTION(
|
||||
isolate(),
|
||||
load_handle,
|
||||
LoadIC::Load(object, Handle<String>::cast(key)),
|
||||
Object);
|
||||
} else if (FLAG_use_ic && !object->IsAccessCheckNeeded()) {
|
||||
if (object->IsString() && key->IsNumber()) {
|
||||
if (state() == UNINITIALIZED) stub = string_stub();
|
||||
@ -1164,11 +1174,14 @@ MaybeObject* KeyedLoadIC::Load(Handle<Object> object, Handle<Object> key) {
|
||||
TRACE_IC("LoadIC", key);
|
||||
}
|
||||
|
||||
if (maybe_object != NULL) return maybe_object;
|
||||
if (!load_handle.is_null()) return load_handle;
|
||||
Handle<Object> result;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
|
||||
isolate(), result, Runtime::GetObjectProperty(isolate(), object, key));
|
||||
return *result;
|
||||
ASSIGN_RETURN_ON_EXCEPTION(
|
||||
isolate(),
|
||||
result,
|
||||
Runtime::GetObjectProperty(isolate(), object, key),
|
||||
Object);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@ -1232,17 +1245,19 @@ static bool LookupForWrite(Handle<JSObject> receiver,
|
||||
}
|
||||
|
||||
|
||||
MaybeObject* StoreIC::Store(Handle<Object> object,
|
||||
Handle<String> name,
|
||||
Handle<Object> value,
|
||||
JSReceiver::StoreFromKeyed store_mode) {
|
||||
MaybeHandle<Object> StoreIC::Store(Handle<Object> object,
|
||||
Handle<String> name,
|
||||
Handle<Object> value,
|
||||
JSReceiver::StoreFromKeyed store_mode) {
|
||||
if (MigrateDeprecated(object) || object->IsJSProxy()) {
|
||||
Handle<JSReceiver> receiver = Handle<JSReceiver>::cast(object);
|
||||
Handle<Object> result;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
|
||||
isolate(), result,
|
||||
JSReceiver::SetProperty(receiver, name, value, NONE, strict_mode()));
|
||||
return *result;
|
||||
ASSIGN_RETURN_ON_EXCEPTION(
|
||||
isolate(),
|
||||
result,
|
||||
JSReceiver::SetProperty(receiver, name, value, NONE, strict_mode()),
|
||||
Object);
|
||||
return result;
|
||||
}
|
||||
|
||||
// If the object is undefined or null it's illegal to try to set any
|
||||
@ -1259,7 +1274,7 @@ MaybeObject* StoreIC::Store(Handle<Object> object,
|
||||
|
||||
// Ignore other stores where the receiver is not a JSObject.
|
||||
// TODO(1475): Must check prototype chains of object wrappers.
|
||||
if (!object->IsJSObject()) return *value;
|
||||
if (!object->IsJSObject()) return value;
|
||||
|
||||
Handle<JSObject> receiver = Handle<JSObject>::cast(object);
|
||||
|
||||
@ -1267,20 +1282,24 @@ MaybeObject* StoreIC::Store(Handle<Object> object,
|
||||
uint32_t index;
|
||||
if (name->AsArrayIndex(&index)) {
|
||||
Handle<Object> result;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
|
||||
isolate(), result,
|
||||
JSObject::SetElement(receiver, index, value, NONE, strict_mode()));
|
||||
return *value;
|
||||
ASSIGN_RETURN_ON_EXCEPTION(
|
||||
isolate(),
|
||||
result,
|
||||
JSObject::SetElement(receiver, index, value, NONE, strict_mode()),
|
||||
Object);
|
||||
return value;
|
||||
}
|
||||
|
||||
// Observed objects are always modified through the runtime.
|
||||
if (receiver->map()->is_observed()) {
|
||||
Handle<Object> result;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
|
||||
isolate(), result,
|
||||
ASSIGN_RETURN_ON_EXCEPTION(
|
||||
isolate(),
|
||||
result,
|
||||
JSReceiver::SetProperty(
|
||||
receiver, name, value, NONE, strict_mode(), store_mode));
|
||||
return *result;
|
||||
receiver, name, value, NONE, strict_mode(), store_mode),
|
||||
Object);
|
||||
return result;
|
||||
}
|
||||
|
||||
LookupResult lookup(isolate());
|
||||
@ -1309,11 +1328,13 @@ MaybeObject* StoreIC::Store(Handle<Object> object,
|
||||
|
||||
// Set the property.
|
||||
Handle<Object> result;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
|
||||
isolate(), result,
|
||||
ASSIGN_RETURN_ON_EXCEPTION(
|
||||
isolate(),
|
||||
result,
|
||||
JSReceiver::SetProperty(
|
||||
receiver, name, value, NONE, strict_mode(), store_mode));
|
||||
return *result;
|
||||
receiver, name, value, NONE, strict_mode(), store_mode),
|
||||
Object);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@ -1704,31 +1725,36 @@ KeyedAccessStoreMode KeyedStoreIC::GetStoreMode(Handle<JSObject> receiver,
|
||||
}
|
||||
|
||||
|
||||
MaybeObject* KeyedStoreIC::Store(Handle<Object> object,
|
||||
Handle<Object> key,
|
||||
Handle<Object> value) {
|
||||
MaybeHandle<Object> KeyedStoreIC::Store(Handle<Object> object,
|
||||
Handle<Object> key,
|
||||
Handle<Object> value) {
|
||||
if (MigrateDeprecated(object)) {
|
||||
Handle<Object> result;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
|
||||
isolate(), result,
|
||||
ASSIGN_RETURN_ON_EXCEPTION(
|
||||
isolate(),
|
||||
result,
|
||||
Runtime::SetObjectProperty(
|
||||
isolate(), object, key, value, NONE, strict_mode()));
|
||||
return *result;
|
||||
isolate(), object, key, value, NONE, strict_mode()),
|
||||
Object);
|
||||
return result;
|
||||
}
|
||||
|
||||
// Check for non-string values that can be converted into an
|
||||
// internalized string directly or is representable as a smi.
|
||||
key = TryConvertKey(key, isolate());
|
||||
|
||||
MaybeObject* maybe_object = NULL;
|
||||
Handle<Object> store_handle;
|
||||
Handle<Code> stub = generic_stub();
|
||||
|
||||
if (key->IsInternalizedString()) {
|
||||
maybe_object = StoreIC::Store(object,
|
||||
Handle<String>::cast(key),
|
||||
value,
|
||||
JSReceiver::MAY_BE_STORE_FROM_KEYED);
|
||||
if (maybe_object->IsFailure()) return maybe_object;
|
||||
ASSIGN_RETURN_ON_EXCEPTION(
|
||||
isolate(),
|
||||
store_handle,
|
||||
StoreIC::Store(object,
|
||||
Handle<String>::cast(key),
|
||||
value,
|
||||
JSReceiver::MAY_BE_STORE_FROM_KEYED),
|
||||
Object);
|
||||
} else {
|
||||
bool use_ic = FLAG_use_ic &&
|
||||
!object->IsStringWrapper() &&
|
||||
@ -1780,13 +1806,15 @@ MaybeObject* KeyedStoreIC::Store(Handle<Object> object,
|
||||
TRACE_IC("StoreIC", key);
|
||||
}
|
||||
|
||||
if (maybe_object) return maybe_object;
|
||||
if (!store_handle.is_null()) return store_handle;
|
||||
Handle<Object> result;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
|
||||
isolate(), result,
|
||||
ASSIGN_RETURN_ON_EXCEPTION(
|
||||
isolate(),
|
||||
result,
|
||||
Runtime::SetObjectProperty(
|
||||
isolate(), object, key, value, NONE, strict_mode()));
|
||||
return *result;
|
||||
isolate(), object, key, value, NONE, strict_mode()),
|
||||
Object);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@ -1806,7 +1834,9 @@ RUNTIME_FUNCTION(MaybeObject*, LoadIC_Miss) {
|
||||
Handle<Object> receiver = args.at<Object>(0);
|
||||
Handle<String> key = args.at<String>(1);
|
||||
ic.UpdateState(receiver, key);
|
||||
return ic.Load(receiver, key);
|
||||
Handle<Object> result;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, ic.Load(receiver, key));
|
||||
return *result;
|
||||
}
|
||||
|
||||
|
||||
@ -1818,7 +1848,9 @@ RUNTIME_FUNCTION(MaybeObject*, KeyedLoadIC_Miss) {
|
||||
Handle<Object> receiver = args.at<Object>(0);
|
||||
Handle<Object> key = args.at<Object>(1);
|
||||
ic.UpdateState(receiver, key);
|
||||
return ic.Load(receiver, key);
|
||||
Handle<Object> result;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, ic.Load(receiver, key));
|
||||
return *result;
|
||||
}
|
||||
|
||||
|
||||
@ -1829,7 +1861,9 @@ RUNTIME_FUNCTION(MaybeObject*, KeyedLoadIC_MissFromStubFailure) {
|
||||
Handle<Object> receiver = args.at<Object>(0);
|
||||
Handle<Object> key = args.at<Object>(1);
|
||||
ic.UpdateState(receiver, key);
|
||||
return ic.Load(receiver, key);
|
||||
Handle<Object> result;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, ic.Load(receiver, key));
|
||||
return *result;
|
||||
}
|
||||
|
||||
|
||||
@ -1841,7 +1875,12 @@ RUNTIME_FUNCTION(MaybeObject*, StoreIC_Miss) {
|
||||
Handle<Object> receiver = args.at<Object>(0);
|
||||
Handle<String> key = args.at<String>(1);
|
||||
ic.UpdateState(receiver, key);
|
||||
return ic.Store(receiver, key, args.at<Object>(2));
|
||||
Handle<Object> result;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
|
||||
isolate,
|
||||
result,
|
||||
ic.Store(receiver, key, args.at<Object>(2)));
|
||||
return *result;
|
||||
}
|
||||
|
||||
|
||||
@ -1852,7 +1891,12 @@ RUNTIME_FUNCTION(MaybeObject*, StoreIC_MissFromStubFailure) {
|
||||
Handle<Object> receiver = args.at<Object>(0);
|
||||
Handle<String> key = args.at<String>(1);
|
||||
ic.UpdateState(receiver, key);
|
||||
return ic.Store(receiver, key, args.at<Object>(2));
|
||||
Handle<Object> result;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
|
||||
isolate,
|
||||
result,
|
||||
ic.Store(receiver, key, args.at<Object>(2)));
|
||||
return *result;
|
||||
}
|
||||
|
||||
|
||||
@ -1883,46 +1927,42 @@ RUNTIME_FUNCTION(MaybeObject*, StoreIC_ArrayLength) {
|
||||
// it is necessary to extend the properties array of a
|
||||
// JSObject.
|
||||
RUNTIME_FUNCTION(MaybeObject*, SharedStoreIC_ExtendStorage) {
|
||||
SealHandleScope shs(isolate);
|
||||
HandleScope shs(isolate);
|
||||
ASSERT(args.length() == 3);
|
||||
|
||||
// Convert the parameters
|
||||
JSObject* object = JSObject::cast(args[0]);
|
||||
Map* transition = Map::cast(args[1]);
|
||||
Object* value = args[2];
|
||||
Handle<JSObject> object = args.at<JSObject>(0);
|
||||
Handle<Map> transition = args.at<Map>(1);
|
||||
Handle<Object> value = args.at<Object>(2);
|
||||
|
||||
// Check the object has run out out property space.
|
||||
ASSERT(object->HasFastProperties());
|
||||
ASSERT(object->map()->unused_property_fields() == 0);
|
||||
|
||||
// Expand the properties array.
|
||||
FixedArray* old_storage = object->properties();
|
||||
Handle<FixedArray> old_storage = handle(object->properties(), isolate);
|
||||
int new_unused = transition->unused_property_fields();
|
||||
int new_size = old_storage->length() + new_unused + 1;
|
||||
Object* result;
|
||||
MaybeObject* maybe_result = old_storage->CopySize(new_size);
|
||||
if (!maybe_result->ToObject(&result)) return maybe_result;
|
||||
|
||||
FixedArray* new_storage = FixedArray::cast(result);
|
||||
Handle<FixedArray> new_storage = isolate->factory()->CopySizeFixedArray(
|
||||
old_storage, new_size);
|
||||
|
||||
Object* to_store = value;
|
||||
Handle<Object> to_store = value;
|
||||
|
||||
DescriptorArray* descriptors = transition->instance_descriptors();
|
||||
PropertyDetails details = descriptors->GetDetails(transition->LastAdded());
|
||||
PropertyDetails details = transition->instance_descriptors()->GetDetails(
|
||||
transition->LastAdded());
|
||||
if (details.representation().IsDouble()) {
|
||||
MaybeObject* maybe_storage =
|
||||
isolate->heap()->AllocateHeapNumber(value->Number());
|
||||
if (!maybe_storage->To(&to_store)) return maybe_storage;
|
||||
to_store = isolate->factory()->NewHeapNumber(value->Number());
|
||||
}
|
||||
|
||||
new_storage->set(old_storage->length(), to_store);
|
||||
new_storage->set(old_storage->length(), *to_store);
|
||||
|
||||
// Set the new property value and do the map transition.
|
||||
object->set_properties(new_storage);
|
||||
object->set_map(transition);
|
||||
object->set_properties(*new_storage);
|
||||
object->set_map(*transition);
|
||||
|
||||
// Return the stored value.
|
||||
return value;
|
||||
return *value;
|
||||
}
|
||||
|
||||
|
||||
@ -1934,7 +1974,12 @@ RUNTIME_FUNCTION(MaybeObject*, KeyedStoreIC_Miss) {
|
||||
Handle<Object> receiver = args.at<Object>(0);
|
||||
Handle<Object> key = args.at<Object>(1);
|
||||
ic.UpdateState(receiver, key);
|
||||
return ic.Store(receiver, key, args.at<Object>(2));
|
||||
Handle<Object> result;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
|
||||
isolate,
|
||||
result,
|
||||
ic.Store(receiver, key, args.at<Object>(2)));
|
||||
return *result;
|
||||
}
|
||||
|
||||
|
||||
@ -1945,7 +1990,12 @@ RUNTIME_FUNCTION(MaybeObject*, KeyedStoreIC_MissFromStubFailure) {
|
||||
Handle<Object> receiver = args.at<Object>(0);
|
||||
Handle<Object> key = args.at<Object>(1);
|
||||
ic.UpdateState(receiver, key);
|
||||
return ic.Store(receiver, key, args.at<Object>(2));
|
||||
Handle<Object> result;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
|
||||
isolate,
|
||||
result,
|
||||
ic.Store(receiver, key, args.at<Object>(2)));
|
||||
return *result;
|
||||
}
|
||||
|
||||
|
||||
@ -2425,9 +2475,10 @@ Type* BinaryOpIC::State::KindToType(Kind kind, Zone* zone) {
|
||||
}
|
||||
|
||||
|
||||
MaybeObject* BinaryOpIC::Transition(Handle<AllocationSite> allocation_site,
|
||||
Handle<Object> left,
|
||||
Handle<Object> right) {
|
||||
MaybeHandle<Object> BinaryOpIC::Transition(
|
||||
Handle<AllocationSite> allocation_site,
|
||||
Handle<Object> left,
|
||||
Handle<Object> right) {
|
||||
State state(target()->extra_ic_state());
|
||||
|
||||
// Compute the actual result using the builtin for the binary operation.
|
||||
@ -2435,9 +2486,11 @@ MaybeObject* BinaryOpIC::Transition(Handle<AllocationSite> allocation_site,
|
||||
TokenToJSBuiltin(state.op()));
|
||||
Handle<JSFunction> function = handle(JSFunction::cast(builtin), isolate());
|
||||
Handle<Object> result;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
|
||||
isolate(), result,
|
||||
Execution::Call(isolate(), function, left, 1, &right));
|
||||
ASSIGN_RETURN_ON_EXCEPTION(
|
||||
isolate(),
|
||||
result,
|
||||
Execution::Call(isolate(), function, left, 1, &right),
|
||||
Object);
|
||||
|
||||
// Execution::Call can execute arbitrary JavaScript, hence potentially
|
||||
// update the state of this very IC, so we must update the stored state.
|
||||
@ -2495,7 +2548,7 @@ MaybeObject* BinaryOpIC::Transition(Handle<AllocationSite> allocation_site,
|
||||
PatchInlinedSmiCode(address(), DISABLE_INLINED_SMI_CHECK);
|
||||
}
|
||||
|
||||
return *result;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@ -2505,7 +2558,12 @@ RUNTIME_FUNCTION(MaybeObject*, BinaryOpIC_Miss) {
|
||||
Handle<Object> left = args.at<Object>(BinaryOpICStub::kLeft);
|
||||
Handle<Object> right = args.at<Object>(BinaryOpICStub::kRight);
|
||||
BinaryOpIC ic(isolate);
|
||||
return ic.Transition(Handle<AllocationSite>::null(), left, right);
|
||||
Handle<Object> result;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
|
||||
isolate,
|
||||
result,
|
||||
ic.Transition(Handle<AllocationSite>::null(), left, right));
|
||||
return *result;
|
||||
}
|
||||
|
||||
|
||||
@ -2519,7 +2577,12 @@ RUNTIME_FUNCTION(MaybeObject*, BinaryOpIC_MissWithAllocationSite) {
|
||||
Handle<Object> right = args.at<Object>(
|
||||
BinaryOpWithAllocationSiteStub::kRight);
|
||||
BinaryOpIC ic(isolate);
|
||||
return ic.Transition(allocation_site, left, right);
|
||||
Handle<Object> result;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
|
||||
isolate,
|
||||
result,
|
||||
ic.Transition(allocation_site, left, right));
|
||||
return *result;
|
||||
}
|
||||
|
||||
|
||||
@ -2761,16 +2824,17 @@ void CompareNilIC::Clear(Address address,
|
||||
}
|
||||
|
||||
|
||||
MaybeObject* CompareNilIC::DoCompareNilSlow(NilValue nil,
|
||||
Handle<Object> object) {
|
||||
Handle<Object> CompareNilIC::DoCompareNilSlow(Isolate* isolate,
|
||||
NilValue nil,
|
||||
Handle<Object> object) {
|
||||
if (object->IsNull() || object->IsUndefined()) {
|
||||
return Smi::FromInt(true);
|
||||
return handle(Smi::FromInt(true), isolate);
|
||||
}
|
||||
return Smi::FromInt(object->IsUndetectableObject());
|
||||
return handle(Smi::FromInt(object->IsUndetectableObject()), isolate);
|
||||
}
|
||||
|
||||
|
||||
MaybeObject* CompareNilIC::CompareNil(Handle<Object> object) {
|
||||
Handle<Object> CompareNilIC::CompareNil(Handle<Object> object) {
|
||||
ExtraICState extra_ic_state = target()->extra_ic_state();
|
||||
|
||||
CompareNilICStub stub(extra_ic_state);
|
||||
@ -2794,7 +2858,7 @@ MaybeObject* CompareNilIC::CompareNil(Handle<Object> object) {
|
||||
code = stub.GetCode(isolate());
|
||||
}
|
||||
set_target(*code);
|
||||
return DoCompareNilSlow(nil, object);
|
||||
return DoCompareNilSlow(isolate(), nil, object);
|
||||
}
|
||||
|
||||
|
||||
@ -2802,7 +2866,7 @@ RUNTIME_FUNCTION(MaybeObject*, CompareNilIC_Miss) {
|
||||
HandleScope scope(isolate);
|
||||
Handle<Object> object = args.at<Object>(0);
|
||||
CompareNilIC ic(isolate);
|
||||
return ic.CompareNil(object);
|
||||
return *ic.CompareNil(object);
|
||||
}
|
||||
|
||||
|
||||
@ -2854,12 +2918,12 @@ Builtins::JavaScript BinaryOpIC::TokenToJSBuiltin(Token::Value op) {
|
||||
}
|
||||
|
||||
|
||||
MaybeObject* ToBooleanIC::ToBoolean(Handle<Object> object) {
|
||||
Handle<Object> ToBooleanIC::ToBoolean(Handle<Object> object) {
|
||||
ToBooleanStub stub(target()->extra_ic_state());
|
||||
bool to_boolean_value = stub.UpdateStatus(object);
|
||||
Handle<Code> code = stub.GetCode(isolate());
|
||||
set_target(*code);
|
||||
return Smi::FromInt(to_boolean_value ? 1 : 0);
|
||||
return handle(Smi::FromInt(to_boolean_value ? 1 : 0), isolate());
|
||||
}
|
||||
|
||||
|
||||
@ -2868,7 +2932,7 @@ RUNTIME_FUNCTION(MaybeObject*, ToBooleanIC_Miss) {
|
||||
HandleScope scope(isolate);
|
||||
Handle<Object> object = args.at<Object>(0);
|
||||
ToBooleanIC ic(isolate);
|
||||
return ic.ToBoolean(object);
|
||||
return *ic.ToBoolean(object);
|
||||
}
|
||||
|
||||
|
||||
|
38
src/ic.h
38
src/ic.h
@ -196,10 +196,10 @@ class IC {
|
||||
void TraceIC(const char* type, Handle<Object> name);
|
||||
#endif
|
||||
|
||||
Failure* TypeError(const char* type,
|
||||
Handle<Object> object,
|
||||
Handle<Object> key);
|
||||
Failure* ReferenceError(const char* type, Handle<String> name);
|
||||
MaybeHandle<Object> TypeError(const char* type,
|
||||
Handle<Object> object,
|
||||
Handle<Object> key);
|
||||
MaybeHandle<Object> ReferenceError(const char* type, Handle<String> name);
|
||||
|
||||
// Access the target code for the given IC address.
|
||||
static inline Code* GetTargetAtAddress(Address address,
|
||||
@ -397,8 +397,8 @@ class LoadIC: public IC {
|
||||
static Handle<Code> initialize_stub(Isolate* isolate,
|
||||
ExtraICState extra_state);
|
||||
|
||||
MUST_USE_RESULT MaybeObject* Load(Handle<Object> object,
|
||||
Handle<String> name);
|
||||
MUST_USE_RESULT MaybeHandle<Object> Load(Handle<Object> object,
|
||||
Handle<String> name);
|
||||
|
||||
protected:
|
||||
virtual Code::Kind kind() const { return Code::LOAD_IC; }
|
||||
@ -459,8 +459,8 @@ class KeyedLoadIC: public LoadIC {
|
||||
ASSERT(target()->is_keyed_load_stub());
|
||||
}
|
||||
|
||||
MUST_USE_RESULT MaybeObject* Load(Handle<Object> object,
|
||||
Handle<Object> key);
|
||||
MUST_USE_RESULT MaybeHandle<Object> Load(Handle<Object> object,
|
||||
Handle<Object> key);
|
||||
|
||||
// Code generator routines.
|
||||
static void GenerateMiss(MacroAssembler* masm);
|
||||
@ -564,7 +564,7 @@ class StoreIC: public IC {
|
||||
static Handle<Code> initialize_stub(Isolate* isolate,
|
||||
StrictMode strict_mode);
|
||||
|
||||
MUST_USE_RESULT MaybeObject* Store(
|
||||
MUST_USE_RESULT MaybeHandle<Object> Store(
|
||||
Handle<Object> object,
|
||||
Handle<String> name,
|
||||
Handle<Object> value,
|
||||
@ -653,9 +653,9 @@ class KeyedStoreIC: public StoreIC {
|
||||
ASSERT(target()->is_keyed_store_stub());
|
||||
}
|
||||
|
||||
MUST_USE_RESULT MaybeObject* Store(Handle<Object> object,
|
||||
Handle<Object> name,
|
||||
Handle<Object> value);
|
||||
MUST_USE_RESULT MaybeHandle<Object> Store(Handle<Object> object,
|
||||
Handle<Object> name,
|
||||
Handle<Object> value);
|
||||
|
||||
// Code generators for stub routines. Only called once at startup.
|
||||
static void GenerateInitialize(MacroAssembler* masm) { GenerateMiss(masm); }
|
||||
@ -860,9 +860,9 @@ class BinaryOpIC: public IC {
|
||||
|
||||
static Builtins::JavaScript TokenToJSBuiltin(Token::Value op);
|
||||
|
||||
MaybeObject* Transition(Handle<AllocationSite> allocation_site,
|
||||
Handle<Object> left,
|
||||
Handle<Object> right) V8_WARN_UNUSED_RESULT;
|
||||
MaybeHandle<Object> Transition(Handle<AllocationSite> allocation_site,
|
||||
Handle<Object> left,
|
||||
Handle<Object> right) V8_WARN_UNUSED_RESULT;
|
||||
};
|
||||
|
||||
|
||||
@ -944,7 +944,7 @@ class CompareNilIC: public IC {
|
||||
public:
|
||||
explicit CompareNilIC(Isolate* isolate) : IC(EXTRA_CALL_FRAME, isolate) {}
|
||||
|
||||
MUST_USE_RESULT MaybeObject* CompareNil(Handle<Object> object);
|
||||
Handle<Object> CompareNil(Handle<Object> object);
|
||||
|
||||
static Handle<Code> GetUninitialized();
|
||||
|
||||
@ -952,8 +952,8 @@ class CompareNilIC: public IC {
|
||||
Code* target,
|
||||
ConstantPoolArray* constant_pool);
|
||||
|
||||
static MUST_USE_RESULT MaybeObject* DoCompareNilSlow(NilValue nil,
|
||||
Handle<Object> object);
|
||||
static Handle<Object> DoCompareNilSlow(Isolate* isolate, NilValue nil,
|
||||
Handle<Object> object);
|
||||
};
|
||||
|
||||
|
||||
@ -961,7 +961,7 @@ class ToBooleanIC: public IC {
|
||||
public:
|
||||
explicit ToBooleanIC(Isolate* isolate) : IC(EXTRA_CALL_FRAME, isolate) { }
|
||||
|
||||
MaybeObject* ToBoolean(Handle<Object> object);
|
||||
Handle<Object> ToBoolean(Handle<Object> object);
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user