| OLD | NEW |
| 1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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 #include "src/code-stub-assembler.h" | 4 #include "src/code-stub-assembler.h" |
| 5 #include "src/code-factory.h" | 5 #include "src/code-factory.h" |
| 6 #include "src/frames-inl.h" | 6 #include "src/frames-inl.h" |
| 7 #include "src/frames.h" | 7 #include "src/frames.h" |
| 8 | 8 |
| 9 namespace v8 { | 9 namespace v8 { |
| 10 namespace internal { | 10 namespace internal { |
| (...skipping 4449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4460 BIND(&runtime); | 4460 BIND(&runtime); |
| 4461 { | 4461 { |
| 4462 result.Bind(CallRuntime(Runtime::kToString, context, input)); | 4462 result.Bind(CallRuntime(Runtime::kToString, context, input)); |
| 4463 Goto(&done); | 4463 Goto(&done); |
| 4464 } | 4464 } |
| 4465 | 4465 |
| 4466 BIND(&done); | 4466 BIND(&done); |
| 4467 return result.value(); | 4467 return result.value(); |
| 4468 } | 4468 } |
| 4469 | 4469 |
| 4470 Node* CodeStubAssembler::ToString_Inline(Node* const context, |
| 4471 Node* const input) { |
| 4472 VARIABLE(var_result, MachineRepresentation::kTagged, input); |
| 4473 Label stub_call(this, Label::kDeferred), out(this); |
| 4474 |
| 4475 GotoIf(TaggedIsSmi(input), &stub_call); |
| 4476 Branch(IsString(input), &out, &stub_call); |
| 4477 |
| 4478 BIND(&stub_call); |
| 4479 var_result.Bind(CallBuiltin(Builtins::kToString, context, input)); |
| 4480 Goto(&out); |
| 4481 |
| 4482 BIND(&out); |
| 4483 return var_result.value(); |
| 4484 } |
| 4485 |
| 4470 Node* CodeStubAssembler::JSReceiverToPrimitive(Node* context, Node* input) { | 4486 Node* CodeStubAssembler::JSReceiverToPrimitive(Node* context, Node* input) { |
| 4471 Label if_isreceiver(this, Label::kDeferred), if_isnotreceiver(this); | 4487 Label if_isreceiver(this, Label::kDeferred), if_isnotreceiver(this); |
| 4472 VARIABLE(result, MachineRepresentation::kTagged); | 4488 VARIABLE(result, MachineRepresentation::kTagged); |
| 4473 Label done(this, &result); | 4489 Label done(this, &result); |
| 4474 | 4490 |
| 4475 BranchIfJSReceiver(input, &if_isreceiver, &if_isnotreceiver); | 4491 BranchIfJSReceiver(input, &if_isreceiver, &if_isnotreceiver); |
| 4476 | 4492 |
| 4477 BIND(&if_isreceiver); | 4493 BIND(&if_isreceiver); |
| 4478 { | 4494 { |
| 4479 // Convert {input} to a primitive first passing Number hint. | 4495 // Convert {input} to a primitive first passing Number hint. |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4537 Branch(SmiLessThan(result.value(), SmiConstant(0)), &return_zero, &done); | 4553 Branch(SmiLessThan(result.value(), SmiConstant(0)), &return_zero, &done); |
| 4538 | 4554 |
| 4539 BIND(&return_zero); | 4555 BIND(&return_zero); |
| 4540 result.Bind(SmiConstant(0)); | 4556 result.Bind(SmiConstant(0)); |
| 4541 Goto(&done); | 4557 Goto(&done); |
| 4542 | 4558 |
| 4543 BIND(&done); | 4559 BIND(&done); |
| 4544 return result.value(); | 4560 return result.value(); |
| 4545 } | 4561 } |
| 4546 | 4562 |
| 4563 Node* CodeStubAssembler::ToLength_Inline(Node* const context, |
| 4564 Node* const input) { |
| 4565 Node* const smi_zero = SmiConstant(0); |
| 4566 return Select( |
| 4567 TaggedIsSmi(input), [=] { return SmiMax(input, smi_zero); }, |
| 4568 [=] { return CallBuiltin(Builtins::kToLength, context, input); }, |
| 4569 MachineRepresentation::kTagged); |
| 4570 } |
| 4571 |
| 4547 Node* CodeStubAssembler::ToInteger(Node* context, Node* input, | 4572 Node* CodeStubAssembler::ToInteger(Node* context, Node* input, |
| 4548 ToIntegerTruncationMode mode) { | 4573 ToIntegerTruncationMode mode) { |
| 4549 // We might need to loop once for ToNumber conversion. | 4574 // We might need to loop once for ToNumber conversion. |
| 4550 VARIABLE(var_arg, MachineRepresentation::kTagged, input); | 4575 VARIABLE(var_arg, MachineRepresentation::kTagged, input); |
| 4551 Label loop(this, &var_arg), out(this); | 4576 Label loop(this, &var_arg), out(this); |
| 4552 Goto(&loop); | 4577 Goto(&loop); |
| 4553 BIND(&loop); | 4578 BIND(&loop); |
| 4554 { | 4579 { |
| 4555 // Shared entry points. | 4580 // Shared entry points. |
| 4556 Label return_zero(this, Label::kDeferred); | 4581 Label return_zero(this, Label::kDeferred); |
| (...skipping 4523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9080 formatted.c_str(), TENURED); | 9105 formatted.c_str(), TENURED); |
| 9081 CallRuntime(Runtime::kGlobalPrint, NoContextConstant(), | 9106 CallRuntime(Runtime::kGlobalPrint, NoContextConstant(), |
| 9082 HeapConstant(string)); | 9107 HeapConstant(string)); |
| 9083 } | 9108 } |
| 9084 CallRuntime(Runtime::kDebugPrint, NoContextConstant(), tagged_value); | 9109 CallRuntime(Runtime::kDebugPrint, NoContextConstant(), tagged_value); |
| 9085 #endif | 9110 #endif |
| 9086 } | 9111 } |
| 9087 | 9112 |
| 9088 } // namespace internal | 9113 } // namespace internal |
| 9089 } // namespace v8 | 9114 } // namespace v8 |
| OLD | NEW |