| 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 10990 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11001 HInstruction* instr = NULL; | 11001 HInstruction* instr = NULL; |
| 11002 // Only the stub is allowed to call into the runtime, since otherwise we would | 11002 // Only the stub is allowed to call into the runtime, since otherwise we would |
| 11003 // inline several instructions (including the two pushes) for every tagged | 11003 // inline several instructions (including the two pushes) for every tagged |
| 11004 // operation in optimized code, which is more expensive, than a stub call. | 11004 // operation in optimized code, which is more expensive, than a stub call. |
| 11005 if (graph()->info()->IsStub() && is_non_primitive) { | 11005 if (graph()->info()->IsStub() && is_non_primitive) { |
| 11006 HValue* function = | 11006 HValue* function = |
| 11007 AddLoadJSBuiltin(BinaryOpIC::TokenToJSBuiltin(op, strength)); | 11007 AddLoadJSBuiltin(BinaryOpIC::TokenToJSBuiltin(op, strength)); |
| 11008 Add<HPushArguments>(left, right); | 11008 Add<HPushArguments>(left, right); |
| 11009 instr = AddUncasted<HInvokeFunction>(function, 2); | 11009 instr = AddUncasted<HInvokeFunction>(function, 2); |
| 11010 } else { | 11010 } else { |
| 11011 if (is_strong(strength) && Token::IsBitOp(op)) { | |
| 11012 // TODO(conradw): This is not efficient, but is necessary to prevent | |
| 11013 // conversion of oddball values to numbers in strong mode. It would be | |
| 11014 // better to prevent the conversion rather than adding a runtime check. | |
| 11015 IfBuilder if_builder(this); | |
| 11016 if_builder.If<HHasInstanceTypeAndBranch>(left, ODDBALL_TYPE); | |
| 11017 if_builder.OrIf<HHasInstanceTypeAndBranch>(right, ODDBALL_TYPE); | |
| 11018 if_builder.Then(); | |
| 11019 Add<HCallRuntime>( | |
| 11020 isolate()->factory()->empty_string(), | |
| 11021 Runtime::FunctionForId(Runtime::kThrowStrongModeImplicitConversion), | |
| 11022 0); | |
| 11023 if (!graph()->info()->IsStub()) { | |
| 11024 Add<HSimulate>(opt_id, REMOVABLE_SIMULATE); | |
| 11025 } | |
| 11026 if_builder.End(); | |
| 11027 } | |
| 11028 switch (op) { | 11011 switch (op) { |
| 11029 case Token::ADD: | 11012 case Token::ADD: |
| 11030 instr = AddUncasted<HAdd>(left, right, strength); | 11013 instr = AddUncasted<HAdd>(left, right, strength); |
| 11031 break; | 11014 break; |
| 11032 case Token::SUB: | 11015 case Token::SUB: |
| 11033 instr = AddUncasted<HSub>(left, right, strength); | 11016 instr = AddUncasted<HSub>(left, right, strength); |
| 11034 break; | 11017 break; |
| 11035 case Token::MUL: | 11018 case Token::MUL: |
| 11036 instr = AddUncasted<HMul>(left, right, strength); | 11019 instr = AddUncasted<HMul>(left, right, strength); |
| 11037 break; | 11020 break; |
| (...skipping 2397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13435 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13418 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
| 13436 } | 13419 } |
| 13437 | 13420 |
| 13438 #ifdef DEBUG | 13421 #ifdef DEBUG |
| 13439 graph_->Verify(false); // No full verify. | 13422 graph_->Verify(false); // No full verify. |
| 13440 #endif | 13423 #endif |
| 13441 } | 13424 } |
| 13442 | 13425 |
| 13443 } // namespace internal | 13426 } // namespace internal |
| 13444 } // namespace v8 | 13427 } // namespace v8 |
| OLD | NEW |