Index: src/crankshaft/hydrogen.cc |
diff --git a/src/crankshaft/hydrogen.cc b/src/crankshaft/hydrogen.cc |
index a39a8e5617cd7ea91cf82dc3dbf325b5cda04313..cf5e010afdcb32c1b663909d8ca47fb56cbd9a58 100644 |
--- a/src/crankshaft/hydrogen.cc |
+++ b/src/crankshaft/hydrogen.cc |
@@ -12636,6 +12636,34 @@ |
} |
+void HOptimizedGraphBuilder::GenerateValueOf(CallRuntime* call) { |
+ DCHECK(call->arguments()->length() == 1); |
+ CHECK_ALIVE(VisitForValue(call->arguments()->at(0))); |
+ HValue* object = Pop(); |
+ |
+ IfBuilder if_objectisvalue(this); |
+ HValue* objectisvalue = if_objectisvalue.If<HHasInstanceTypeAndBranch>( |
+ object, JS_VALUE_TYPE); |
+ if_objectisvalue.Then(); |
+ { |
+ // Return the actual value. |
+ Push(Add<HLoadNamedField>( |
+ object, objectisvalue, |
+ HObjectAccess::ForObservableJSObjectOffset( |
+ JSValue::kValueOffset))); |
+ Add<HSimulate>(call->id(), FIXED_SIMULATE); |
+ } |
+ if_objectisvalue.Else(); |
+ { |
+ // If the object is not a value return the object. |
+ Push(object); |
+ Add<HSimulate>(call->id(), FIXED_SIMULATE); |
+ } |
+ if_objectisvalue.End(); |
+ return ast_context()->ReturnValue(Pop()); |
+} |
+ |
+ |
// Fast support for charCodeAt(n). |
void HOptimizedGraphBuilder::GenerateStringCharCodeAt(CallRuntime* call) { |
DCHECK(call->arguments()->length() == 2); |