OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 6243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6254 void HGraphBuilder::GenerateValueOf(CallRuntime* call) { | 6254 void HGraphBuilder::GenerateValueOf(CallRuntime* call) { |
6255 ASSERT(call->arguments()->length() == 1); | 6255 ASSERT(call->arguments()->length() == 1); |
6256 CHECK_ALIVE(VisitForValue(call->arguments()->at(0))); | 6256 CHECK_ALIVE(VisitForValue(call->arguments()->at(0))); |
6257 HValue* value = Pop(); | 6257 HValue* value = Pop(); |
6258 HValueOf* result = new(zone()) HValueOf(value); | 6258 HValueOf* result = new(zone()) HValueOf(value); |
6259 return ast_context()->ReturnInstruction(result, call->id()); | 6259 return ast_context()->ReturnInstruction(result, call->id()); |
6260 } | 6260 } |
6261 | 6261 |
6262 | 6262 |
6263 void HGraphBuilder::GenerateSetValueOf(CallRuntime* call) { | 6263 void HGraphBuilder::GenerateSetValueOf(CallRuntime* call) { |
6264 return Bailout("inlined runtime function: SetValueOf"); | 6264 ASSERT(call->arguments()->length() == 2); |
| 6265 CHECK_ALIVE(VisitForValue(call->arguments()->at(0))); |
| 6266 CHECK_ALIVE(VisitForValue(call->arguments()->at(1))); |
| 6267 HValue* value = Pop(); |
| 6268 HValue* object = Pop(); |
| 6269 // Check if object is a not a smi. |
| 6270 HIsSmiAndBranch* smicheck = new(zone()) HIsSmiAndBranch(object); |
| 6271 HBasicBlock* if_smi = graph()->CreateBasicBlock(); |
| 6272 HBasicBlock* if_heap_object = graph()->CreateBasicBlock(); |
| 6273 HBasicBlock* join = graph()->CreateBasicBlock(); |
| 6274 smicheck->SetSuccessorAt(0, if_smi); |
| 6275 smicheck->SetSuccessorAt(1, if_heap_object); |
| 6276 current_block()->Finish(smicheck); |
| 6277 if_smi->Goto(join); |
| 6278 |
| 6279 // Check if object is a JSValue. |
| 6280 set_current_block(if_heap_object); |
| 6281 HHasInstanceTypeAndBranch* typecheck = |
| 6282 new(zone()) HHasInstanceTypeAndBranch(object, JS_VALUE_TYPE); |
| 6283 HBasicBlock* if_js_value = graph()->CreateBasicBlock(); |
| 6284 HBasicBlock* not_js_value = graph()->CreateBasicBlock(); |
| 6285 typecheck->SetSuccessorAt(0, if_js_value); |
| 6286 typecheck->SetSuccessorAt(1, not_js_value); |
| 6287 current_block()->Finish(typecheck); |
| 6288 not_js_value->Goto(join); |
| 6289 |
| 6290 // Create in-object property store to kValueOffset. |
| 6291 set_current_block(if_js_value); |
| 6292 Handle<String> name = isolate()->factory()->undefined_symbol(); |
| 6293 AddInstruction(new HStoreNamedField(object, |
| 6294 name, |
| 6295 value, |
| 6296 true, // in-object store. |
| 6297 JSValue::kValueOffset)); |
| 6298 if_js_value->Goto(join); |
| 6299 join->SetJoinId(call->id()); |
| 6300 set_current_block(join); |
| 6301 return ast_context()->ReturnValue(value); |
6265 } | 6302 } |
6266 | 6303 |
6267 | 6304 |
6268 // Fast support for charCodeAt(n). | 6305 // Fast support for charCodeAt(n). |
6269 void HGraphBuilder::GenerateStringCharCodeAt(CallRuntime* call) { | 6306 void HGraphBuilder::GenerateStringCharCodeAt(CallRuntime* call) { |
6270 ASSERT(call->arguments()->length() == 2); | 6307 ASSERT(call->arguments()->length() == 2); |
6271 CHECK_ALIVE(VisitForValue(call->arguments()->at(0))); | 6308 CHECK_ALIVE(VisitForValue(call->arguments()->at(0))); |
6272 CHECK_ALIVE(VisitForValue(call->arguments()->at(1))); | 6309 CHECK_ALIVE(VisitForValue(call->arguments()->at(1))); |
6273 HValue* index = Pop(); | 6310 HValue* index = Pop(); |
6274 HValue* string = Pop(); | 6311 HValue* string = Pop(); |
(...skipping 782 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7057 } | 7094 } |
7058 } | 7095 } |
7059 | 7096 |
7060 #ifdef DEBUG | 7097 #ifdef DEBUG |
7061 if (graph_ != NULL) graph_->Verify(false); // No full verify. | 7098 if (graph_ != NULL) graph_->Verify(false); // No full verify. |
7062 if (allocator_ != NULL) allocator_->Verify(); | 7099 if (allocator_ != NULL) allocator_->Verify(); |
7063 #endif | 7100 #endif |
7064 } | 7101 } |
7065 | 7102 |
7066 } } // namespace v8::internal | 7103 } } // namespace v8::internal |
OLD | NEW |