OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 10240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10251 return ast_context()->ReturnValue(graph()->GetConstantUndefined()); | 10251 return ast_context()->ReturnValue(graph()->GetConstantUndefined()); |
10252 } | 10252 } |
10253 | 10253 |
10254 | 10254 |
10255 void HOptimizedGraphBuilder::GenerateSetValueOf(CallRuntime* call) { | 10255 void HOptimizedGraphBuilder::GenerateSetValueOf(CallRuntime* call) { |
10256 ASSERT(call->arguments()->length() == 2); | 10256 ASSERT(call->arguments()->length() == 2); |
10257 CHECK_ALIVE(VisitForValue(call->arguments()->at(0))); | 10257 CHECK_ALIVE(VisitForValue(call->arguments()->at(0))); |
10258 CHECK_ALIVE(VisitForValue(call->arguments()->at(1))); | 10258 CHECK_ALIVE(VisitForValue(call->arguments()->at(1))); |
10259 HValue* value = Pop(); | 10259 HValue* value = Pop(); |
10260 HValue* object = Pop(); | 10260 HValue* object = Pop(); |
10261 // Check if object is a not a smi. | |
10262 HBasicBlock* if_smi = graph()->CreateBasicBlock(); | |
10263 HBasicBlock* if_heap_object = graph()->CreateBasicBlock(); | |
10264 HBasicBlock* join = graph()->CreateBasicBlock(); | |
10265 FinishCurrentBlock(New<HIsSmiAndBranch>(object, if_smi, if_heap_object)); | |
10266 Goto(if_smi, join); | |
10267 | 10261 |
10268 // Check if object is a JSValue. | 10262 // Check if object is a JSValue. |
10269 set_current_block(if_heap_object); | 10263 IfBuilder if_objectisvalue(this); |
10270 HHasInstanceTypeAndBranch* typecheck = | 10264 if_objectisvalue.If<HHasInstanceTypeAndBranch>(object, JS_VALUE_TYPE); |
10271 New<HHasInstanceTypeAndBranch>(object, JS_VALUE_TYPE); | 10265 if_objectisvalue.Then(); |
10272 HBasicBlock* if_js_value = graph()->CreateBasicBlock(); | 10266 { |
10273 HBasicBlock* not_js_value = graph()->CreateBasicBlock(); | 10267 // Create in-object property store to kValueOffset. |
10274 typecheck->SetSuccessorAt(0, if_js_value); | 10268 Add<HStoreNamedField>( |
10275 typecheck->SetSuccessorAt(1, not_js_value); | 10269 object, HObjectAccess::ForJSObjectOffset(JSValue::kValueOffset), |
10276 FinishCurrentBlock(typecheck); | 10270 value, INITIALIZING_STORE); |
10277 Goto(not_js_value, join); | 10271 Add<HSimulate>(call->id(), FIXED_SIMULATE); |
10278 | 10272 } |
10279 // Create in-object property store to kValueOffset. | 10273 if_objectisvalue.Else(); |
10280 set_current_block(if_js_value); | 10274 { |
10281 Add<HStoreNamedField>(object, | 10275 // Nothing to do in this case. |
10282 HObjectAccess::ForJSObjectOffset(JSValue::kValueOffset), value, | 10276 Add<HSimulate>(call->id(), FIXED_SIMULATE); |
10283 INITIALIZING_STORE); | 10277 } |
10284 Goto(if_js_value, join); | 10278 if_objectisvalue.End(); |
10285 join->SetJoinId(call->id()); | |
10286 set_current_block(join); | |
10287 return ast_context()->ReturnValue(value); | 10279 return ast_context()->ReturnValue(value); |
10288 } | 10280 } |
10289 | 10281 |
10290 | 10282 |
10291 // Fast support for charCodeAt(n). | 10283 // Fast support for charCodeAt(n). |
10292 void HOptimizedGraphBuilder::GenerateStringCharCodeAt(CallRuntime* call) { | 10284 void HOptimizedGraphBuilder::GenerateStringCharCodeAt(CallRuntime* call) { |
10293 ASSERT(call->arguments()->length() == 2); | 10285 ASSERT(call->arguments()->length() == 2); |
10294 CHECK_ALIVE(VisitForValue(call->arguments()->at(0))); | 10286 CHECK_ALIVE(VisitForValue(call->arguments()->at(0))); |
10295 CHECK_ALIVE(VisitForValue(call->arguments()->at(1))); | 10287 CHECK_ALIVE(VisitForValue(call->arguments()->at(1))); |
10296 HValue* index = Pop(); | 10288 HValue* index = Pop(); |
(...skipping 838 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11135 if (ShouldProduceTraceOutput()) { | 11127 if (ShouldProduceTraceOutput()) { |
11136 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 11128 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
11137 } | 11129 } |
11138 | 11130 |
11139 #ifdef DEBUG | 11131 #ifdef DEBUG |
11140 graph_->Verify(false); // No full verify. | 11132 graph_->Verify(false); // No full verify. |
11141 #endif | 11133 #endif |
11142 } | 11134 } |
11143 | 11135 |
11144 } } // namespace v8::internal | 11136 } } // namespace v8::internal |
OLD | NEW |