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 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 Label checkstringtag(this); | 201 Label checkstringtag(this); |
202 Label if_tostringtag(this), if_notostringtag(this); | 202 Label if_tostringtag(this), if_notostringtag(this); |
203 | 203 |
204 Node* receiver = Parameter(Descriptor::kReceiver); | 204 Node* receiver = Parameter(Descriptor::kReceiver); |
205 Node* context = Parameter(Descriptor::kContext); | 205 Node* context = Parameter(Descriptor::kContext); |
206 | 206 |
207 GotoIf(WordEqual(receiver, UndefinedConstant()), &return_undefined); | 207 GotoIf(WordEqual(receiver, UndefinedConstant()), &return_undefined); |
208 | 208 |
209 GotoIf(WordEqual(receiver, NullConstant()), &return_null); | 209 GotoIf(WordEqual(receiver, NullConstant()), &return_null); |
210 | 210 |
211 Callable to_object = CodeFactory::ToObject(isolate()); | 211 receiver = CallBuiltin(Builtins::kToObject, context, receiver); |
212 receiver = CallStub(to_object, context, receiver); | |
213 | 212 |
214 Node* receiver_instance_type = LoadInstanceType(receiver); | 213 Node* receiver_instance_type = LoadInstanceType(receiver); |
215 | 214 |
216 // for proxies, check IsArray before getting @@toStringTag | 215 // for proxies, check IsArray before getting @@toStringTag |
217 VARIABLE(var_proxy_is_array, MachineRepresentation::kTagged); | 216 VARIABLE(var_proxy_is_array, MachineRepresentation::kTagged); |
218 var_proxy_is_array.Bind(BooleanConstant(false)); | 217 var_proxy_is_array.Bind(BooleanConstant(false)); |
219 | 218 |
220 Branch(Word32Equal(receiver_instance_type, Int32Constant(JS_PROXY_TYPE)), | 219 Branch(Word32Equal(receiver_instance_type, Int32Constant(JS_PROXY_TYPE)), |
221 &if_isproxy, &checkstringtag); | 220 &if_isproxy, &checkstringtag); |
222 | 221 |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 BIND(&return_object); | 346 BIND(&return_object); |
348 Return(HeapConstant(isolate()->factory()->object_to_string())); | 347 Return(HeapConstant(isolate()->factory()->object_to_string())); |
349 } | 348 } |
350 } | 349 } |
351 | 350 |
352 // ES6 #sec-object.prototype.valueof | 351 // ES6 #sec-object.prototype.valueof |
353 TF_BUILTIN(ObjectPrototypeValueOf, CodeStubAssembler) { | 352 TF_BUILTIN(ObjectPrototypeValueOf, CodeStubAssembler) { |
354 Node* receiver = Parameter(Descriptor::kReceiver); | 353 Node* receiver = Parameter(Descriptor::kReceiver); |
355 Node* context = Parameter(Descriptor::kContext); | 354 Node* context = Parameter(Descriptor::kContext); |
356 | 355 |
357 Callable to_object = CodeFactory::ToObject(isolate()); | 356 Return(CallBuiltin(Builtins::kToObject, context, receiver)); |
358 receiver = CallStub(to_object, context, receiver); | |
359 | |
360 Return(receiver); | |
361 } | 357 } |
362 | 358 |
363 // ES #sec-object.create | 359 // ES #sec-object.create |
364 TF_BUILTIN(ObjectCreate, ObjectBuiltinsAssembler) { | 360 TF_BUILTIN(ObjectCreate, ObjectBuiltinsAssembler) { |
365 Node* prototype = Parameter(Descriptor::kPrototype); | 361 Node* prototype = Parameter(Descriptor::kPrototype); |
366 Node* properties = Parameter(Descriptor::kProperties); | 362 Node* properties = Parameter(Descriptor::kProperties); |
367 Node* context = Parameter(Descriptor::kContext); | 363 Node* context = Parameter(Descriptor::kContext); |
368 | 364 |
369 Label call_runtime(this, Label::kDeferred), prototype_valid(this), | 365 Label call_runtime(this, Label::kDeferred), prototype_valid(this), |
370 no_properties(this); | 366 no_properties(this); |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
535 | 531 |
536 BIND(&runtime); | 532 BIND(&runtime); |
537 { | 533 { |
538 Return(CallRuntime(Runtime::kCreateJSGeneratorObject, context, closure, | 534 Return(CallRuntime(Runtime::kCreateJSGeneratorObject, context, closure, |
539 receiver)); | 535 receiver)); |
540 } | 536 } |
541 } | 537 } |
542 | 538 |
543 } // namespace internal | 539 } // namespace internal |
544 } // namespace v8 | 540 } // namespace v8 |
OLD | NEW |