| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/crankshaft/hydrogen.h" | 5 #include "src/crankshaft/hydrogen.h" |
| 6 | 6 |
| 7 #include <sstream> | 7 #include <sstream> |
| 8 | 8 |
| 9 #include "src/allocation-site-scopes.h" | 9 #include "src/allocation-site-scopes.h" |
| 10 #include "src/ast/ast-numbering.h" | 10 #include "src/ast/ast-numbering.h" |
| (...skipping 12462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12473 { | 12473 { |
| 12474 // If the object is not a value return the object. | 12474 // If the object is not a value return the object. |
| 12475 Push(object); | 12475 Push(object); |
| 12476 Add<HSimulate>(call->id(), FIXED_SIMULATE); | 12476 Add<HSimulate>(call->id(), FIXED_SIMULATE); |
| 12477 } | 12477 } |
| 12478 if_objectisvalue.End(); | 12478 if_objectisvalue.End(); |
| 12479 return ast_context()->ReturnValue(Pop()); | 12479 return ast_context()->ReturnValue(Pop()); |
| 12480 } | 12480 } |
| 12481 | 12481 |
| 12482 | 12482 |
| 12483 void HOptimizedGraphBuilder::GenerateJSValueGetValue(CallRuntime* call) { | |
| 12484 DCHECK(call->arguments()->length() == 1); | |
| 12485 CHECK_ALIVE(VisitForValue(call->arguments()->at(0))); | |
| 12486 HValue* value = Pop(); | |
| 12487 HInstruction* result = Add<HLoadNamedField>( | |
| 12488 value, nullptr, | |
| 12489 HObjectAccess::ForObservableJSObjectOffset(JSValue::kValueOffset)); | |
| 12490 return ast_context()->ReturnInstruction(result, call->id()); | |
| 12491 } | |
| 12492 | |
| 12493 | |
| 12494 void HOptimizedGraphBuilder::GenerateIsDate(CallRuntime* call) { | 12483 void HOptimizedGraphBuilder::GenerateIsDate(CallRuntime* call) { |
| 12495 DCHECK_EQ(1, call->arguments()->length()); | 12484 DCHECK_EQ(1, call->arguments()->length()); |
| 12496 CHECK_ALIVE(VisitForValue(call->arguments()->at(0))); | 12485 CHECK_ALIVE(VisitForValue(call->arguments()->at(0))); |
| 12497 HValue* value = Pop(); | 12486 HValue* value = Pop(); |
| 12498 HHasInstanceTypeAndBranch* result = | 12487 HHasInstanceTypeAndBranch* result = |
| 12499 New<HHasInstanceTypeAndBranch>(value, JS_DATE_TYPE); | 12488 New<HHasInstanceTypeAndBranch>(value, JS_DATE_TYPE); |
| 12500 return ast_context()->ReturnControl(result, call->id()); | 12489 return ast_context()->ReturnControl(result, call->id()); |
| 12501 } | 12490 } |
| 12502 | 12491 |
| 12503 | 12492 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 12526 HValue* string = Pop(); | 12515 HValue* string = Pop(); |
| 12527 HValue* value = Pop(); | 12516 HValue* value = Pop(); |
| 12528 HValue* index = Pop(); | 12517 HValue* index = Pop(); |
| 12529 Add<HSeqStringSetChar>(String::TWO_BYTE_ENCODING, string, | 12518 Add<HSeqStringSetChar>(String::TWO_BYTE_ENCODING, string, |
| 12530 index, value); | 12519 index, value); |
| 12531 Add<HSimulate>(call->id(), FIXED_SIMULATE); | 12520 Add<HSimulate>(call->id(), FIXED_SIMULATE); |
| 12532 return ast_context()->ReturnValue(graph()->GetConstantUndefined()); | 12521 return ast_context()->ReturnValue(graph()->GetConstantUndefined()); |
| 12533 } | 12522 } |
| 12534 | 12523 |
| 12535 | 12524 |
| 12536 void HOptimizedGraphBuilder::GenerateSetValueOf(CallRuntime* call) { | |
| 12537 DCHECK(call->arguments()->length() == 2); | |
| 12538 CHECK_ALIVE(VisitForValue(call->arguments()->at(0))); | |
| 12539 CHECK_ALIVE(VisitForValue(call->arguments()->at(1))); | |
| 12540 HValue* value = Pop(); | |
| 12541 HValue* object = Pop(); | |
| 12542 | |
| 12543 // Check if object is a JSValue. | |
| 12544 IfBuilder if_objectisvalue(this); | |
| 12545 if_objectisvalue.If<HHasInstanceTypeAndBranch>(object, JS_VALUE_TYPE); | |
| 12546 if_objectisvalue.Then(); | |
| 12547 { | |
| 12548 // Create in-object property store to kValueOffset. | |
| 12549 Add<HStoreNamedField>(object, | |
| 12550 HObjectAccess::ForObservableJSObjectOffset(JSValue::kValueOffset), | |
| 12551 value); | |
| 12552 if (!ast_context()->IsEffect()) { | |
| 12553 Push(value); | |
| 12554 } | |
| 12555 Add<HSimulate>(call->id(), FIXED_SIMULATE); | |
| 12556 } | |
| 12557 if_objectisvalue.Else(); | |
| 12558 { | |
| 12559 // Nothing to do in this case. | |
| 12560 if (!ast_context()->IsEffect()) { | |
| 12561 Push(value); | |
| 12562 } | |
| 12563 Add<HSimulate>(call->id(), FIXED_SIMULATE); | |
| 12564 } | |
| 12565 if_objectisvalue.End(); | |
| 12566 if (!ast_context()->IsEffect()) { | |
| 12567 Drop(1); | |
| 12568 } | |
| 12569 return ast_context()->ReturnValue(value); | |
| 12570 } | |
| 12571 | |
| 12572 | |
| 12573 // Fast support for charCodeAt(n). | 12525 // Fast support for charCodeAt(n). |
| 12574 void HOptimizedGraphBuilder::GenerateStringCharCodeAt(CallRuntime* call) { | 12526 void HOptimizedGraphBuilder::GenerateStringCharCodeAt(CallRuntime* call) { |
| 12575 DCHECK(call->arguments()->length() == 2); | 12527 DCHECK(call->arguments()->length() == 2); |
| 12576 CHECK_ALIVE(VisitForValue(call->arguments()->at(0))); | 12528 CHECK_ALIVE(VisitForValue(call->arguments()->at(0))); |
| 12577 CHECK_ALIVE(VisitForValue(call->arguments()->at(1))); | 12529 CHECK_ALIVE(VisitForValue(call->arguments()->at(1))); |
| 12578 HValue* index = Pop(); | 12530 HValue* index = Pop(); |
| 12579 HValue* string = Pop(); | 12531 HValue* string = Pop(); |
| 12580 HInstruction* result = BuildStringCharCodeAt(string, index); | 12532 HInstruction* result = BuildStringCharCodeAt(string, index); |
| 12581 return ast_context()->ReturnInstruction(result, call->id()); | 12533 return ast_context()->ReturnInstruction(result, call->id()); |
| 12582 } | 12534 } |
| (...skipping 1031 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13614 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13566 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
| 13615 } | 13567 } |
| 13616 | 13568 |
| 13617 #ifdef DEBUG | 13569 #ifdef DEBUG |
| 13618 graph_->Verify(false); // No full verify. | 13570 graph_->Verify(false); // No full verify. |
| 13619 #endif | 13571 #endif |
| 13620 } | 13572 } |
| 13621 | 13573 |
| 13622 } // namespace internal | 13574 } // namespace internal |
| 13623 } // namespace v8 | 13575 } // namespace v8 |
| OLD | NEW |