Index: src/arm/stub-cache-arm.cc |
=================================================================== |
--- src/arm/stub-cache-arm.cc (revision 5696) |
+++ src/arm/stub-cache-arm.cc (working copy) |
@@ -834,13 +834,16 @@ |
// Generate code to check that a global property cell is empty. Create |
// the property cell at compilation time if no cell exists for the |
// property. |
-static Object* GenerateCheckPropertyCell(MacroAssembler* masm, |
- GlobalObject* global, |
- String* name, |
- Register scratch, |
- Label* miss) { |
- Object* probe = global->EnsurePropertyCell(name); |
- if (probe->IsFailure()) return probe; |
+MUST_USE_RESULT static MaybeObject* GenerateCheckPropertyCell( |
+ MacroAssembler* masm, |
+ GlobalObject* global, |
+ String* name, |
+ Register scratch, |
+ Label* miss) { |
+ Object* probe; |
+ { MaybeObject* maybe_probe = global->EnsurePropertyCell(name); |
+ if (!maybe_probe->ToObject(&probe)) return maybe_probe; |
+ } |
JSGlobalPropertyCell* cell = JSGlobalPropertyCell::cast(probe); |
ASSERT(cell->value()->IsTheHole()); |
__ mov(scratch, Operand(Handle<Object>(cell))); |
@@ -894,12 +897,12 @@ |
!current->IsJSGlobalObject() && |
!current->IsJSGlobalProxy()) { |
if (!name->IsSymbol()) { |
- Object* lookup_result = Heap::LookupSymbol(name); |
+ MaybeObject* lookup_result = Heap::LookupSymbol(name); |
if (lookup_result->IsFailure()) { |
set_failure(Failure::cast(lookup_result)); |
return reg; |
} else { |
- name = String::cast(lookup_result); |
+ name = String::cast(lookup_result->ToObjectUnchecked()); |
} |
} |
ASSERT(current->property_dictionary()->FindEntry(name) == |
@@ -974,11 +977,11 @@ |
current = object; |
while (current != holder) { |
if (current->IsGlobalObject()) { |
- Object* cell = GenerateCheckPropertyCell(masm(), |
- GlobalObject::cast(current), |
- name, |
- scratch1, |
- miss); |
+ MaybeObject* cell = GenerateCheckPropertyCell(masm(), |
+ GlobalObject::cast(current), |
+ name, |
+ scratch1, |
+ miss); |
if (cell->IsFailure()) { |
set_failure(Failure::cast(cell)); |
return reg; |
@@ -1281,18 +1284,21 @@ |
} |
-Object* CallStubCompiler::GenerateMissBranch() { |
- Object* obj = StubCache::ComputeCallMiss(arguments().immediate(), kind_); |
- if (obj->IsFailure()) return obj; |
+MaybeObject* CallStubCompiler::GenerateMissBranch() { |
+ Object* obj; |
+ { MaybeObject* maybe_obj = |
+ StubCache::ComputeCallMiss(arguments().immediate(), kind_); |
+ if (!maybe_obj->ToObject(&obj)) return maybe_obj; |
+ } |
__ Jump(Handle<Code>(Code::cast(obj)), RelocInfo::CODE_TARGET); |
return obj; |
} |
-Object* CallStubCompiler::CompileCallField(JSObject* object, |
- JSObject* holder, |
- int index, |
- String* name) { |
+MaybeObject* CallStubCompiler::CompileCallField(JSObject* object, |
+ JSObject* holder, |
+ int index, |
+ String* name) { |
// ----------- S t a t e ------------- |
// -- r2 : name |
// -- lr : return address |
@@ -1317,19 +1323,21 @@ |
// Handle call cache miss. |
__ bind(&miss); |
- Object* obj = GenerateMissBranch(); |
- if (obj->IsFailure()) return obj; |
+ Object* obj; |
+ { MaybeObject* maybe_obj = GenerateMissBranch(); |
+ if (!maybe_obj->ToObject(&obj)) return maybe_obj; |
+ } |
// Return the generated code. |
return GetCode(FIELD, name); |
} |
-Object* CallStubCompiler::CompileArrayPushCall(Object* object, |
- JSObject* holder, |
- JSGlobalPropertyCell* cell, |
- JSFunction* function, |
- String* name) { |
+MaybeObject* CallStubCompiler::CompileArrayPushCall(Object* object, |
+ JSObject* holder, |
+ JSGlobalPropertyCell* cell, |
+ JSFunction* function, |
+ String* name) { |
// ----------- S t a t e ------------- |
// -- r2 : name |
// -- lr : return address |
@@ -1361,19 +1369,21 @@ |
// Handle call cache miss. |
__ bind(&miss); |
- Object* obj = GenerateMissBranch(); |
- if (obj->IsFailure()) return obj; |
+ Object* obj; |
+ { MaybeObject* maybe_obj = GenerateMissBranch(); |
+ if (!maybe_obj->ToObject(&obj)) return maybe_obj; |
+ } |
// Return the generated code. |
return GetCode(function); |
} |
-Object* CallStubCompiler::CompileArrayPopCall(Object* object, |
- JSObject* holder, |
- JSGlobalPropertyCell* cell, |
- JSFunction* function, |
- String* name) { |
+MaybeObject* CallStubCompiler::CompileArrayPopCall(Object* object, |
+ JSObject* holder, |
+ JSGlobalPropertyCell* cell, |
+ JSFunction* function, |
+ String* name) { |
// ----------- S t a t e ------------- |
// -- r2 : name |
// -- lr : return address |
@@ -1405,15 +1415,17 @@ |
// Handle call cache miss. |
__ bind(&miss); |
- Object* obj = GenerateMissBranch(); |
- if (obj->IsFailure()) return obj; |
+ Object* obj; |
+ { MaybeObject* maybe_obj = GenerateMissBranch(); |
+ if (!maybe_obj->ToObject(&obj)) return maybe_obj; |
+ } |
// Return the generated code. |
return GetCode(function); |
} |
-Object* CallStubCompiler::CompileStringCharCodeAtCall( |
+MaybeObject* CallStubCompiler::CompileStringCharCodeAtCall( |
Object* object, |
JSObject* holder, |
JSGlobalPropertyCell* cell, |
@@ -1477,19 +1489,22 @@ |
__ Ret(); |
__ bind(&miss); |
- Object* obj = GenerateMissBranch(); |
- if (obj->IsFailure()) return obj; |
+ Object* obj; |
+ { MaybeObject* maybe_obj = GenerateMissBranch(); |
+ if (!maybe_obj->ToObject(&obj)) return maybe_obj; |
+ } |
// Return the generated code. |
return GetCode(function); |
} |
-Object* CallStubCompiler::CompileStringCharAtCall(Object* object, |
- JSObject* holder, |
- JSGlobalPropertyCell* cell, |
- JSFunction* function, |
- String* name) { |
+MaybeObject* CallStubCompiler::CompileStringCharAtCall( |
+ Object* object, |
+ JSObject* holder, |
+ JSGlobalPropertyCell* cell, |
+ JSFunction* function, |
+ String* name) { |
// ----------- S t a t e ------------- |
// -- r2 : function name |
// -- lr : return address |
@@ -1551,15 +1566,17 @@ |
__ Ret(); |
__ bind(&miss); |
- Object* obj = GenerateMissBranch(); |
- if (obj->IsFailure()) return obj; |
+ Object* obj; |
+ { MaybeObject* maybe_obj = GenerateMissBranch(); |
+ if (!maybe_obj->ToObject(&obj)) return maybe_obj; |
+ } |
// Return the generated code. |
return GetCode(function); |
} |
-Object* CallStubCompiler::CompileStringFromCharCodeCall( |
+MaybeObject* CallStubCompiler::CompileStringFromCharCodeCall( |
Object* object, |
JSObject* holder, |
JSGlobalPropertyCell* cell, |
@@ -1625,29 +1642,31 @@ |
__ bind(&miss); |
// r2: function name. |
- Object* obj = GenerateMissBranch(); |
- if (obj->IsFailure()) return obj; |
+ Object* obj; |
+ { MaybeObject* maybe_obj = GenerateMissBranch(); |
+ if (!maybe_obj->ToObject(&obj)) return maybe_obj; |
+ } |
// Return the generated code. |
return (cell == NULL) ? GetCode(function) : GetCode(NORMAL, name); |
} |
-Object* CallStubCompiler::CompileMathFloorCall(Object* object, |
- JSObject* holder, |
- JSGlobalPropertyCell* cell, |
- JSFunction* function, |
- String* name) { |
+MaybeObject* CallStubCompiler::CompileMathFloorCall(Object* object, |
+ JSObject* holder, |
+ JSGlobalPropertyCell* cell, |
+ JSFunction* function, |
+ String* name) { |
// TODO(872): implement this. |
return Heap::undefined_value(); |
} |
-Object* CallStubCompiler::CompileMathAbsCall(Object* object, |
- JSObject* holder, |
- JSGlobalPropertyCell* cell, |
- JSFunction* function, |
- String* name) { |
+MaybeObject* CallStubCompiler::CompileMathAbsCall(Object* object, |
+ JSObject* holder, |
+ JSGlobalPropertyCell* cell, |
+ JSFunction* function, |
+ String* name) { |
// ----------- S t a t e ------------- |
// -- r2 : function name |
// -- lr : return address |
@@ -1737,19 +1756,21 @@ |
__ bind(&miss); |
// r2: function name. |
- Object* obj = GenerateMissBranch(); |
- if (obj->IsFailure()) return obj; |
+ Object* obj; |
+ { MaybeObject* maybe_obj = GenerateMissBranch(); |
+ if (!maybe_obj->ToObject(&obj)) return maybe_obj; |
+ } |
// Return the generated code. |
return (cell == NULL) ? GetCode(function) : GetCode(NORMAL, name); |
} |
-Object* CallStubCompiler::CompileCallConstant(Object* object, |
- JSObject* holder, |
- JSFunction* function, |
- String* name, |
- CheckType check) { |
+MaybeObject* CallStubCompiler::CompileCallConstant(Object* object, |
+ JSObject* holder, |
+ JSFunction* function, |
+ String* name, |
+ CheckType check) { |
// ----------- S t a t e ------------- |
// -- r2 : name |
// -- lr : return address |
@@ -1757,8 +1778,10 @@ |
SharedFunctionInfo* function_info = function->shared(); |
if (function_info->HasCustomCallGenerator()) { |
const int id = function_info->custom_call_generator_id(); |
- Object* result = CompileCustomCall( |
+ MaybeObject* maybe_result = CompileCustomCall( |
id, object, holder, NULL, function, name); |
+ Object* result; |
+ if (!maybe_result->ToObject(&result)) return maybe_result; |
// undefined means bail out to regular compiler. |
if (!result->IsUndefined()) { |
return result; |
@@ -1891,17 +1914,19 @@ |
} |
__ bind(&miss_in_smi_check); |
- Object* obj = GenerateMissBranch(); |
- if (obj->IsFailure()) return obj; |
+ Object* obj; |
+ { MaybeObject* maybe_obj = GenerateMissBranch(); |
+ if (!maybe_obj->ToObject(&obj)) return maybe_obj; |
+ } |
// Return the generated code. |
return GetCode(function); |
} |
-Object* CallStubCompiler::CompileCallInterceptor(JSObject* object, |
- JSObject* holder, |
- String* name) { |
+MaybeObject* CallStubCompiler::CompileCallInterceptor(JSObject* object, |
+ JSObject* holder, |
+ String* name) { |
// ----------- S t a t e ------------- |
// -- r2 : name |
// -- lr : return address |
@@ -1941,19 +1966,21 @@ |
// Handle call cache miss. |
__ bind(&miss); |
- Object* obj = GenerateMissBranch(); |
- if (obj->IsFailure()) return obj; |
+ Object* obj; |
+ { MaybeObject* maybe_obj = GenerateMissBranch(); |
+ if (!maybe_obj->ToObject(&obj)) return maybe_obj; |
+ } |
// Return the generated code. |
return GetCode(INTERCEPTOR, name); |
} |
-Object* CallStubCompiler::CompileCallGlobal(JSObject* object, |
- GlobalObject* holder, |
- JSGlobalPropertyCell* cell, |
- JSFunction* function, |
- String* name) { |
+MaybeObject* CallStubCompiler::CompileCallGlobal(JSObject* object, |
+ GlobalObject* holder, |
+ JSGlobalPropertyCell* cell, |
+ JSFunction* function, |
+ String* name) { |
// ----------- S t a t e ------------- |
// -- r2 : name |
// -- lr : return address |
@@ -1962,8 +1989,10 @@ |
SharedFunctionInfo* function_info = function->shared(); |
if (function_info->HasCustomCallGenerator()) { |
const int id = function_info->custom_call_generator_id(); |
- Object* result = CompileCustomCall( |
+ MaybeObject* maybe_result = CompileCustomCall( |
id, object, holder, cell, function, name); |
+ Object* result; |
+ if (!maybe_result->ToObject(&result)) return maybe_result; |
// undefined means bail out to regular compiler. |
if (!result->IsUndefined()) return result; |
} |
@@ -2000,18 +2029,20 @@ |
// Handle call cache miss. |
__ bind(&miss); |
__ IncrementCounter(&Counters::call_global_inline_miss, 1, r1, r3); |
- Object* obj = GenerateMissBranch(); |
- if (obj->IsFailure()) return obj; |
+ Object* obj; |
+ { MaybeObject* maybe_obj = GenerateMissBranch(); |
+ if (!maybe_obj->ToObject(&obj)) return maybe_obj; |
+ } |
// Return the generated code. |
return GetCode(NORMAL, name); |
} |
-Object* StoreStubCompiler::CompileStoreField(JSObject* object, |
- int index, |
- Map* transition, |
- String* name) { |
+MaybeObject* StoreStubCompiler::CompileStoreField(JSObject* object, |
+ int index, |
+ Map* transition, |
+ String* name) { |
// ----------- S t a t e ------------- |
// -- r0 : value |
// -- r1 : receiver |
@@ -2035,9 +2066,9 @@ |
} |
-Object* StoreStubCompiler::CompileStoreCallback(JSObject* object, |
- AccessorInfo* callback, |
- String* name) { |
+MaybeObject* StoreStubCompiler::CompileStoreCallback(JSObject* object, |
+ AccessorInfo* callback, |
+ String* name) { |
// ----------- S t a t e ------------- |
// -- r0 : value |
// -- r1 : receiver |
@@ -2083,8 +2114,8 @@ |
} |
-Object* StoreStubCompiler::CompileStoreInterceptor(JSObject* receiver, |
- String* name) { |
+MaybeObject* StoreStubCompiler::CompileStoreInterceptor(JSObject* receiver, |
+ String* name) { |
// ----------- S t a t e ------------- |
// -- r0 : value |
// -- r1 : receiver |
@@ -2128,9 +2159,9 @@ |
} |
-Object* StoreStubCompiler::CompileStoreGlobal(GlobalObject* object, |
- JSGlobalPropertyCell* cell, |
- String* name) { |
+MaybeObject* StoreStubCompiler::CompileStoreGlobal(GlobalObject* object, |
+ JSGlobalPropertyCell* cell, |
+ String* name) { |
// ----------- S t a t e ------------- |
// -- r0 : value |
// -- r1 : receiver |
@@ -2162,9 +2193,9 @@ |
} |
-Object* LoadStubCompiler::CompileLoadNonexistent(String* name, |
- JSObject* object, |
- JSObject* last) { |
+MaybeObject* LoadStubCompiler::CompileLoadNonexistent(String* name, |
+ JSObject* object, |
+ JSObject* last) { |
// ----------- S t a t e ------------- |
// -- r0 : receiver |
// -- lr : return address |
@@ -2181,11 +2212,11 @@ |
// If the last object in the prototype chain is a global object, |
// check that the global property cell is empty. |
if (last->IsGlobalObject()) { |
- Object* cell = GenerateCheckPropertyCell(masm(), |
- GlobalObject::cast(last), |
- name, |
- r1, |
- &miss); |
+ MaybeObject* cell = GenerateCheckPropertyCell(masm(), |
+ GlobalObject::cast(last), |
+ name, |
+ r1, |
+ &miss); |
if (cell->IsFailure()) { |
miss.Unuse(); |
return cell; |
@@ -2205,10 +2236,10 @@ |
} |
-Object* LoadStubCompiler::CompileLoadField(JSObject* object, |
- JSObject* holder, |
- int index, |
- String* name) { |
+MaybeObject* LoadStubCompiler::CompileLoadField(JSObject* object, |
+ JSObject* holder, |
+ int index, |
+ String* name) { |
// ----------- S t a t e ------------- |
// -- r0 : receiver |
// -- r2 : name |
@@ -2225,10 +2256,10 @@ |
} |
-Object* LoadStubCompiler::CompileLoadCallback(String* name, |
- JSObject* object, |
- JSObject* holder, |
- AccessorInfo* callback) { |
+MaybeObject* LoadStubCompiler::CompileLoadCallback(String* name, |
+ JSObject* object, |
+ JSObject* holder, |
+ AccessorInfo* callback) { |
// ----------- S t a t e ------------- |
// -- r0 : receiver |
// -- r2 : name |
@@ -2252,10 +2283,10 @@ |
} |
-Object* LoadStubCompiler::CompileLoadConstant(JSObject* object, |
- JSObject* holder, |
- Object* value, |
- String* name) { |
+MaybeObject* LoadStubCompiler::CompileLoadConstant(JSObject* object, |
+ JSObject* holder, |
+ Object* value, |
+ String* name) { |
// ----------- S t a t e ------------- |
// -- r0 : receiver |
// -- r2 : name |
@@ -2272,9 +2303,9 @@ |
} |
-Object* LoadStubCompiler::CompileLoadInterceptor(JSObject* object, |
- JSObject* holder, |
- String* name) { |
+MaybeObject* LoadStubCompiler::CompileLoadInterceptor(JSObject* object, |
+ JSObject* holder, |
+ String* name) { |
// ----------- S t a t e ------------- |
// -- r0 : receiver |
// -- r2 : name |
@@ -2302,11 +2333,11 @@ |
} |
-Object* LoadStubCompiler::CompileLoadGlobal(JSObject* object, |
- GlobalObject* holder, |
- JSGlobalPropertyCell* cell, |
- String* name, |
- bool is_dont_delete) { |
+MaybeObject* LoadStubCompiler::CompileLoadGlobal(JSObject* object, |
+ GlobalObject* holder, |
+ JSGlobalPropertyCell* cell, |
+ String* name, |
+ bool is_dont_delete) { |
// ----------- S t a t e ------------- |
// -- r0 : receiver |
// -- r2 : name |
@@ -2349,10 +2380,10 @@ |
} |
-Object* KeyedLoadStubCompiler::CompileLoadField(String* name, |
- JSObject* receiver, |
- JSObject* holder, |
- int index) { |
+MaybeObject* KeyedLoadStubCompiler::CompileLoadField(String* name, |
+ JSObject* receiver, |
+ JSObject* holder, |
+ int index) { |
// ----------- S t a t e ------------- |
// -- lr : return address |
// -- r0 : key |
@@ -2372,10 +2403,11 @@ |
} |
-Object* KeyedLoadStubCompiler::CompileLoadCallback(String* name, |
- JSObject* receiver, |
- JSObject* holder, |
- AccessorInfo* callback) { |
+MaybeObject* KeyedLoadStubCompiler::CompileLoadCallback( |
+ String* name, |
+ JSObject* receiver, |
+ JSObject* holder, |
+ AccessorInfo* callback) { |
// ----------- S t a t e ------------- |
// -- lr : return address |
// -- r0 : key |
@@ -2402,10 +2434,10 @@ |
} |
-Object* KeyedLoadStubCompiler::CompileLoadConstant(String* name, |
- JSObject* receiver, |
- JSObject* holder, |
- Object* value) { |
+MaybeObject* KeyedLoadStubCompiler::CompileLoadConstant(String* name, |
+ JSObject* receiver, |
+ JSObject* holder, |
+ Object* value) { |
// ----------- S t a t e ------------- |
// -- lr : return address |
// -- r0 : key |
@@ -2426,9 +2458,9 @@ |
} |
-Object* KeyedLoadStubCompiler::CompileLoadInterceptor(JSObject* receiver, |
- JSObject* holder, |
- String* name) { |
+MaybeObject* KeyedLoadStubCompiler::CompileLoadInterceptor(JSObject* receiver, |
+ JSObject* holder, |
+ String* name) { |
// ----------- S t a t e ------------- |
// -- lr : return address |
// -- r0 : key |
@@ -2459,7 +2491,7 @@ |
} |
-Object* KeyedLoadStubCompiler::CompileLoadArrayLength(String* name) { |
+MaybeObject* KeyedLoadStubCompiler::CompileLoadArrayLength(String* name) { |
// ----------- S t a t e ------------- |
// -- lr : return address |
// -- r0 : key |
@@ -2479,7 +2511,7 @@ |
} |
-Object* KeyedLoadStubCompiler::CompileLoadStringLength(String* name) { |
+MaybeObject* KeyedLoadStubCompiler::CompileLoadStringLength(String* name) { |
// ----------- S t a t e ------------- |
// -- lr : return address |
// -- r0 : key |
@@ -2503,7 +2535,7 @@ |
// TODO(1224671): implement the fast case. |
-Object* KeyedLoadStubCompiler::CompileLoadFunctionPrototype(String* name) { |
+MaybeObject* KeyedLoadStubCompiler::CompileLoadFunctionPrototype(String* name) { |
// ----------- S t a t e ------------- |
// -- lr : return address |
// -- r0 : key |
@@ -2515,10 +2547,10 @@ |
} |
-Object* KeyedStoreStubCompiler::CompileStoreField(JSObject* object, |
- int index, |
- Map* transition, |
- String* name) { |
+MaybeObject* KeyedStoreStubCompiler::CompileStoreField(JSObject* object, |
+ int index, |
+ Map* transition, |
+ String* name) { |
// ----------- S t a t e ------------- |
// -- r0 : value |
// -- r1 : key |
@@ -2553,7 +2585,7 @@ |
} |
-Object* ConstructStubCompiler::CompileConstructStub( |
+MaybeObject* ConstructStubCompiler::CompileConstructStub( |
SharedFunctionInfo* shared) { |
// ----------- S t a t e ------------- |
// -- r0 : argc |