| OLD | NEW |
| 1 // Copyright 2017 the V8 project authors. All rights reserved. | 1 // Copyright 2017 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/builtins/builtins-utils-gen.h" | 5 #include "src/builtins/builtins-utils-gen.h" |
| 6 #include "src/builtins/builtins.h" | 6 #include "src/builtins/builtins.h" |
| 7 #include "src/code-stub-assembler.h" | 7 #include "src/code-stub-assembler.h" |
| 8 | 8 |
| 9 namespace v8 { | 9 namespace v8 { |
| 10 namespace internal { | 10 namespace internal { |
| (...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 403 // ES6 #sec-object.prototype.valueof | 403 // ES6 #sec-object.prototype.valueof |
| 404 TF_BUILTIN(ObjectPrototypeValueOf, CodeStubAssembler) { | 404 TF_BUILTIN(ObjectPrototypeValueOf, CodeStubAssembler) { |
| 405 Node* receiver = Parameter(Descriptor::kReceiver); | 405 Node* receiver = Parameter(Descriptor::kReceiver); |
| 406 Node* context = Parameter(Descriptor::kContext); | 406 Node* context = Parameter(Descriptor::kContext); |
| 407 | 407 |
| 408 Return(CallBuiltin(Builtins::kToObject, context, receiver)); | 408 Return(CallBuiltin(Builtins::kToObject, context, receiver)); |
| 409 } | 409 } |
| 410 | 410 |
| 411 // ES #sec-object.create | 411 // ES #sec-object.create |
| 412 TF_BUILTIN(ObjectCreate, ObjectBuiltinsAssembler) { | 412 TF_BUILTIN(ObjectCreate, ObjectBuiltinsAssembler) { |
| 413 Node* prototype = Parameter(Descriptor::kPrototype); | 413 int const kPrototypeArg = 0; |
| 414 Node* properties = Parameter(Descriptor::kProperties); | 414 int const kPropertiesArg = 1; |
| 415 Node* context = Parameter(Descriptor::kContext); | 415 |
| 416 Node* argc = |
| 417 ChangeInt32ToIntPtr(Parameter(BuiltinDescriptor::kArgumentsCount)); |
| 418 CodeStubArguments args(this, argc); |
| 419 |
| 420 Node* prototype = args.GetOptionalArgumentValue(kPrototypeArg); |
| 421 Node* properties = args.GetOptionalArgumentValue(kPropertiesArg); |
| 422 Node* context = Parameter(BuiltinDescriptor::kContext); |
| 416 | 423 |
| 417 Label call_runtime(this, Label::kDeferred), prototype_valid(this), | 424 Label call_runtime(this, Label::kDeferred), prototype_valid(this), |
| 418 no_properties(this); | 425 no_properties(this); |
| 419 { | 426 { |
| 420 Comment("Argument 1 check: prototype"); | 427 Comment("Argument 1 check: prototype"); |
| 421 GotoIf(WordEqual(prototype, NullConstant()), &prototype_valid); | 428 GotoIf(WordEqual(prototype, NullConstant()), &prototype_valid); |
| 422 BranchIfJSReceiver(prototype, &prototype_valid, &call_runtime); | 429 BranchIfJSReceiver(prototype, &prototype_valid, &call_runtime); |
| 423 } | 430 } |
| 424 | 431 |
| 425 BIND(&prototype_valid); | 432 BIND(&prototype_valid); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 Node* weak_cell = | 483 Node* weak_cell = |
| 477 LoadObjectField(prototype_info, PrototypeInfo::kObjectCreateMap); | 484 LoadObjectField(prototype_info, PrototypeInfo::kObjectCreateMap); |
| 478 GotoIf(WordEqual(weak_cell, UndefinedConstant()), &call_runtime); | 485 GotoIf(WordEqual(weak_cell, UndefinedConstant()), &call_runtime); |
| 479 map.Bind(LoadWeakCellValue(weak_cell, &call_runtime)); | 486 map.Bind(LoadWeakCellValue(weak_cell, &call_runtime)); |
| 480 Goto(&instantiate_map); | 487 Goto(&instantiate_map); |
| 481 } | 488 } |
| 482 | 489 |
| 483 BIND(&instantiate_map); | 490 BIND(&instantiate_map); |
| 484 { | 491 { |
| 485 Node* instance = AllocateJSObjectFromMap(map.value(), properties.value()); | 492 Node* instance = AllocateJSObjectFromMap(map.value(), properties.value()); |
| 486 Return(instance); | 493 args.PopAndReturn(instance); |
| 487 } | 494 } |
| 488 } | 495 } |
| 489 | 496 |
| 490 BIND(&call_runtime); | 497 BIND(&call_runtime); |
| 491 { | 498 { |
| 492 Return(CallRuntime(Runtime::kObjectCreate, context, prototype, properties)); | 499 Node* result = |
| 500 CallRuntime(Runtime::kObjectCreate, context, prototype, properties); |
| 501 args.PopAndReturn(result); |
| 493 } | 502 } |
| 494 } | 503 } |
| 495 | 504 |
| 496 TF_BUILTIN(CreateIterResultObject, ObjectBuiltinsAssembler) { | 505 TF_BUILTIN(CreateIterResultObject, ObjectBuiltinsAssembler) { |
| 497 Node* const value = Parameter(Descriptor::kValue); | 506 Node* const value = Parameter(Descriptor::kValue); |
| 498 Node* const done = Parameter(Descriptor::kDone); | 507 Node* const done = Parameter(Descriptor::kDone); |
| 499 Node* const context = Parameter(Descriptor::kContext); | 508 Node* const context = Parameter(Descriptor::kContext); |
| 500 | 509 |
| 501 Node* const native_context = LoadNativeContext(context); | 510 Node* const native_context = LoadNativeContext(context); |
| 502 Node* const map = | 511 Node* const map = |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 583 | 592 |
| 584 BIND(&runtime); | 593 BIND(&runtime); |
| 585 { | 594 { |
| 586 Return(CallRuntime(Runtime::kCreateJSGeneratorObject, context, closure, | 595 Return(CallRuntime(Runtime::kCreateJSGeneratorObject, context, closure, |
| 587 receiver)); | 596 receiver)); |
| 588 } | 597 } |
| 589 } | 598 } |
| 590 | 599 |
| 591 } // namespace internal | 600 } // namespace internal |
| 592 } // namespace v8 | 601 } // namespace v8 |
| OLD | NEW |