| 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/hydrogen.h" | 5 #include "src/hydrogen.h" |
| 6 | 6 |
| 7 #include <sstream> | 7 #include <sstream> |
| 8 | 8 |
| 9 #include "src/v8.h" | 9 #include "src/v8.h" |
| 10 | 10 |
| (...skipping 10323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10334 } | 10334 } |
| 10335 return number; | 10335 return number; |
| 10336 } | 10336 } |
| 10337 | 10337 |
| 10338 | 10338 |
| 10339 HValue* HGraphBuilder::TruncateToNumber(HValue* value, Type** expected) { | 10339 HValue* HGraphBuilder::TruncateToNumber(HValue* value, Type** expected) { |
| 10340 if (value->IsConstant()) { | 10340 if (value->IsConstant()) { |
| 10341 HConstant* constant = HConstant::cast(value); | 10341 HConstant* constant = HConstant::cast(value); |
| 10342 Maybe<HConstant*> number = | 10342 Maybe<HConstant*> number = |
| 10343 constant->CopyToTruncatedNumber(isolate(), zone()); | 10343 constant->CopyToTruncatedNumber(isolate(), zone()); |
| 10344 if (number.has_value) { | 10344 if (number.IsJust()) { |
| 10345 *expected = Type::Number(zone()); | 10345 *expected = Type::Number(zone()); |
| 10346 return AddInstruction(number.value); | 10346 return AddInstruction(number.FromJust()); |
| 10347 } | 10347 } |
| 10348 } | 10348 } |
| 10349 | 10349 |
| 10350 // We put temporary values on the stack, which don't correspond to anything | 10350 // We put temporary values on the stack, which don't correspond to anything |
| 10351 // in baseline code. Since nothing is observable we avoid recording those | 10351 // in baseline code. Since nothing is observable we avoid recording those |
| 10352 // pushes with a NoObservableSideEffectsScope. | 10352 // pushes with a NoObservableSideEffectsScope. |
| 10353 NoObservableSideEffectsScope no_effects(this); | 10353 NoObservableSideEffectsScope no_effects(this); |
| 10354 | 10354 |
| 10355 Type* expected_type = *expected; | 10355 Type* expected_type = *expected; |
| 10356 | 10356 |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10557 case Token::ADD: | 10557 case Token::ADD: |
| 10558 instr = AddUncasted<HAdd>(left, right); | 10558 instr = AddUncasted<HAdd>(left, right); |
| 10559 break; | 10559 break; |
| 10560 case Token::SUB: | 10560 case Token::SUB: |
| 10561 instr = AddUncasted<HSub>(left, right); | 10561 instr = AddUncasted<HSub>(left, right); |
| 10562 break; | 10562 break; |
| 10563 case Token::MUL: | 10563 case Token::MUL: |
| 10564 instr = AddUncasted<HMul>(left, right); | 10564 instr = AddUncasted<HMul>(left, right); |
| 10565 break; | 10565 break; |
| 10566 case Token::MOD: { | 10566 case Token::MOD: { |
| 10567 if (fixed_right_arg.has_value && | 10567 if (fixed_right_arg.IsJust() && |
| 10568 !right->EqualsInteger32Constant(fixed_right_arg.value)) { | 10568 !right->EqualsInteger32Constant(fixed_right_arg.FromJust())) { |
| 10569 HConstant* fixed_right = Add<HConstant>( | 10569 HConstant* fixed_right = |
| 10570 static_cast<int>(fixed_right_arg.value)); | 10570 Add<HConstant>(static_cast<int>(fixed_right_arg.FromJust())); |
| 10571 IfBuilder if_same(this); | 10571 IfBuilder if_same(this); |
| 10572 if_same.If<HCompareNumericAndBranch>(right, fixed_right, Token::EQ); | 10572 if_same.If<HCompareNumericAndBranch>(right, fixed_right, Token::EQ); |
| 10573 if_same.Then(); | 10573 if_same.Then(); |
| 10574 if_same.ElseDeopt(Deoptimizer::kUnexpectedRHSOfBinaryOperation); | 10574 if_same.ElseDeopt(Deoptimizer::kUnexpectedRHSOfBinaryOperation); |
| 10575 right = fixed_right; | 10575 right = fixed_right; |
| 10576 } | 10576 } |
| 10577 instr = AddUncasted<HMod>(left, right); | 10577 instr = AddUncasted<HMod>(left, right); |
| 10578 break; | 10578 break; |
| 10579 } | 10579 } |
| 10580 case Token::DIV: | 10580 case Token::DIV: |
| (...skipping 2858 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13439 if (ShouldProduceTraceOutput()) { | 13439 if (ShouldProduceTraceOutput()) { |
| 13440 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13440 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
| 13441 } | 13441 } |
| 13442 | 13442 |
| 13443 #ifdef DEBUG | 13443 #ifdef DEBUG |
| 13444 graph_->Verify(false); // No full verify. | 13444 graph_->Verify(false); // No full verify. |
| 13445 #endif | 13445 #endif |
| 13446 } | 13446 } |
| 13447 | 13447 |
| 13448 } } // namespace v8::internal | 13448 } } // namespace v8::internal |
| OLD | NEW |