OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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/code-stubs.h" | 5 #include "src/code-stubs.h" |
6 #include "src/compiler/common-operator.h" | 6 #include "src/compiler/common-operator.h" |
7 #include "src/compiler/graph-inl.h" | 7 #include "src/compiler/graph-inl.h" |
8 #include "src/compiler/js-generic-lowering.h" | 8 #include "src/compiler/js-generic-lowering.h" |
9 #include "src/compiler/machine-operator.h" | 9 #include "src/compiler/machine-operator.h" |
10 #include "src/compiler/node-aux-data-inl.h" | 10 #include "src/compiler/node-aux-data-inl.h" |
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
375 | 375 |
376 Node* JSGenericLowering::LowerBranch(Node* node) { | 376 Node* JSGenericLowering::LowerBranch(Node* node) { |
377 Node* test = graph()->NewNode(machine()->WordEqual(), node->InputAt(0), | 377 Node* test = graph()->NewNode(machine()->WordEqual(), node->InputAt(0), |
378 jsgraph()->TrueConstant()); | 378 jsgraph()->TrueConstant()); |
379 node->ReplaceInput(0, test); | 379 node->ReplaceInput(0, test); |
380 return node; | 380 return node; |
381 } | 381 } |
382 | 382 |
383 | 383 |
384 Node* JSGenericLowering::LowerJSUnaryNot(Node* node) { | 384 Node* JSGenericLowering::LowerJSUnaryNot(Node* node) { |
385 ToBooleanStub stub(isolate()); | 385 ToBooleanStub stub(isolate(), ToBooleanStub::RESULT_AS_INVERSE_ODDBALL); |
386 CodeStubInterfaceDescriptor* d = stub.GetInterfaceDescriptor(); | 386 ReplaceWithICStubCall(node, &stub); |
387 CallDescriptor* desc = linkage()->GetStubCallDescriptor(d); | |
388 Node* to_bool = | |
389 graph()->NewNode(common()->Call(desc), CodeConstant(stub.GetCode()), | |
390 NodeProperties::GetValueInput(node, 0), | |
391 NodeProperties::GetContextInput(node), | |
392 NodeProperties::GetEffectInput(node), | |
393 NodeProperties::GetControlInput(node)); | |
394 node->ReplaceInput(0, to_bool); | |
395 PatchInsertInput(node, 1, SmiConstant(Token::EQ)); | |
396 ReplaceWithRuntimeCall(node, Runtime::kBooleanize); | |
397 return node; | 387 return node; |
398 } | 388 } |
399 | 389 |
400 | 390 |
401 Node* JSGenericLowering::LowerJSToBoolean(Node* node) { | 391 Node* JSGenericLowering::LowerJSToBoolean(Node* node) { |
402 ToBooleanStub stub(isolate()); | 392 ToBooleanStub stub(isolate(), ToBooleanStub::RESULT_AS_ODDBALL); |
403 CodeStubInterfaceDescriptor* d = stub.GetInterfaceDescriptor(); | 393 ReplaceWithICStubCall(node, &stub); |
404 CallDescriptor* desc = linkage()->GetStubCallDescriptor(d); | |
405 Node* to_bool = | |
406 graph()->NewNode(common()->Call(desc), CodeConstant(stub.GetCode()), | |
407 NodeProperties::GetValueInput(node, 0), | |
408 NodeProperties::GetContextInput(node), | |
409 NodeProperties::GetEffectInput(node), | |
410 NodeProperties::GetControlInput(node)); | |
411 node->ReplaceInput(0, to_bool); | |
412 PatchInsertInput(node, 1, SmiConstant(Token::NE)); | |
413 ReplaceWithRuntimeCall(node, Runtime::kBooleanize); | |
414 return node; | 394 return node; |
415 } | 395 } |
416 | 396 |
417 | 397 |
418 Node* JSGenericLowering::LowerJSToObject(Node* node) { | 398 Node* JSGenericLowering::LowerJSToObject(Node* node) { |
419 ReplaceWithBuiltinCall(node, Builtins::TO_OBJECT, 1); | 399 ReplaceWithBuiltinCall(node, Builtins::TO_OBJECT, 1); |
420 return node; | 400 return node; |
421 } | 401 } |
422 | 402 |
423 | 403 |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
554 | 534 |
555 Node* JSGenericLowering::LowerJSCallRuntime(Node* node) { | 535 Node* JSGenericLowering::LowerJSCallRuntime(Node* node) { |
556 Runtime::FunctionId function = OpParameter<Runtime::FunctionId>(node); | 536 Runtime::FunctionId function = OpParameter<Runtime::FunctionId>(node); |
557 int arity = OperatorProperties::GetValueInputCount(node->op()); | 537 int arity = OperatorProperties::GetValueInputCount(node->op()); |
558 ReplaceWithRuntimeCall(node, function, arity); | 538 ReplaceWithRuntimeCall(node, function, arity); |
559 return node; | 539 return node; |
560 } | 540 } |
561 } | 541 } |
562 } | 542 } |
563 } // namespace v8::internal::compiler | 543 } // namespace v8::internal::compiler |
OLD | NEW |