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 | 4 |
5 #include "src/builtins/builtins-utils.h" | 5 #include "src/builtins/builtins-utils.h" |
6 #include "src/builtins/builtins.h" | 6 #include "src/builtins/builtins.h" |
7 #include "src/code-factory.h" | 7 #include "src/code-factory.h" |
8 #include "src/code-stub-assembler.h" | 8 #include "src/code-stub-assembler.h" |
9 #include "src/compiler.h" | 9 #include "src/compiler.h" |
10 #include "src/string-builder.h" | 10 #include "src/string-builder.h" |
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 assembler.LoadMapPrototype(bound_function_map.value()); | 360 assembler.LoadMapPrototype(bound_function_map.value()); |
361 assembler.GotoIf(assembler.WordNotEqual(prototype, expected_prototype), | 361 assembler.GotoIf(assembler.WordNotEqual(prototype, expected_prototype), |
362 &slow); | 362 &slow); |
363 | 363 |
364 // Allocate the arguments array. | 364 // Allocate the arguments array. |
365 assembler.Comment("Allocate the arguments array"); | 365 assembler.Comment("Allocate the arguments array"); |
366 Variable argument_array(&assembler, MachineRepresentation::kTagged); | 366 Variable argument_array(&assembler, MachineRepresentation::kTagged); |
367 Label empty_arguments(&assembler); | 367 Label empty_arguments(&assembler); |
368 Label arguments_done(&assembler, &argument_array); | 368 Label arguments_done(&assembler, &argument_array); |
369 assembler.GotoIf( | 369 assembler.GotoIf( |
370 assembler.UintPtrLessThanOrEqual(argc, assembler.IntPtrConstant(1)), | 370 assembler.Uint32LessThanOrEqual(argc, assembler.Int32Constant(1)), |
371 &empty_arguments); | 371 &empty_arguments); |
372 Node* elements_length = | 372 Node* elements_length = assembler.ChangeUint32ToWord( |
373 assembler.IntPtrSub(argc, assembler.IntPtrConstant(1)); | 373 assembler.Int32Sub(argc, assembler.Int32Constant(1))); |
374 Node* elements = assembler.AllocateFixedArray( | 374 Node* elements = assembler.AllocateFixedArray( |
375 FAST_ELEMENTS, elements_length, CodeStubAssembler::INTPTR_PARAMETERS); | 375 FAST_ELEMENTS, elements_length, CodeStubAssembler::INTPTR_PARAMETERS); |
376 Variable index(&assembler, MachineType::PointerRepresentation()); | 376 Variable index(&assembler, MachineType::PointerRepresentation()); |
377 index.Bind(assembler.IntPtrConstant(0)); | 377 index.Bind(assembler.IntPtrConstant(0)); |
378 CodeStubAssembler::VariableList foreach_vars({&index}, assembler.zone()); | 378 CodeStubAssembler::VariableList foreach_vars({&index}, assembler.zone()); |
379 args.ForEach(foreach_vars, | 379 args.ForEach(foreach_vars, |
380 [&assembler, elements, &index](compiler::Node* arg) { | 380 [&assembler, elements, &index](compiler::Node* arg) { |
381 assembler.StoreFixedArrayElement( | 381 assembler.StoreFixedArrayElement( |
382 elements, index.value(), arg, UPDATE_WRITE_BARRIER, 0, | 382 elements, index.value(), arg, UPDATE_WRITE_BARRIER, 0, |
383 CodeStubAssembler::INTPTR_PARAMETERS); | 383 CodeStubAssembler::INTPTR_PARAMETERS); |
384 assembler.Increment(index); | 384 assembler.Increment(index); |
385 }, | 385 }, |
386 assembler.IntPtrConstant(1)); | 386 assembler.IntPtrConstant(1)); |
387 argument_array.Bind(elements); | 387 argument_array.Bind(elements); |
388 assembler.Goto(&arguments_done); | 388 assembler.Goto(&arguments_done); |
389 | 389 |
390 assembler.Bind(&empty_arguments); | 390 assembler.Bind(&empty_arguments); |
391 argument_array.Bind(assembler.EmptyFixedArrayConstant()); | 391 argument_array.Bind(assembler.EmptyFixedArrayConstant()); |
392 assembler.Goto(&arguments_done); | 392 assembler.Goto(&arguments_done); |
393 | 393 |
394 assembler.Bind(&arguments_done); | 394 assembler.Bind(&arguments_done); |
395 | 395 |
396 // Determine bound receiver. | 396 // Determine bound receiver. |
397 assembler.Comment("Determine bound receiver"); | 397 assembler.Comment("Determine bound receiver"); |
398 Variable bound_receiver(&assembler, MachineRepresentation::kTagged); | 398 Variable bound_receiver(&assembler, MachineRepresentation::kTagged); |
399 Label has_receiver(&assembler); | 399 Label has_receiver(&assembler); |
400 Label receiver_done(&assembler, &bound_receiver); | 400 Label receiver_done(&assembler, &bound_receiver); |
401 assembler.GotoIf(assembler.WordNotEqual(argc, assembler.IntPtrConstant(0)), | 401 assembler.GotoIf(assembler.Word32NotEqual(argc, assembler.Int32Constant(0)), |
402 &has_receiver); | 402 &has_receiver); |
403 bound_receiver.Bind(assembler.UndefinedConstant()); | 403 bound_receiver.Bind(assembler.UndefinedConstant()); |
404 assembler.Goto(&receiver_done); | 404 assembler.Goto(&receiver_done); |
405 | 405 |
406 assembler.Bind(&has_receiver); | 406 assembler.Bind(&has_receiver); |
407 bound_receiver.Bind(args.AtIndex(0)); | 407 bound_receiver.Bind(args.AtIndex(0)); |
408 assembler.Goto(&receiver_done); | 408 assembler.Goto(&receiver_done); |
409 | 409 |
410 assembler.Bind(&receiver_done); | 410 assembler.Bind(&receiver_done); |
411 | 411 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
471 | 471 |
472 Node* f = assembler.Parameter(0); | 472 Node* f = assembler.Parameter(0); |
473 Node* v = assembler.Parameter(1); | 473 Node* v = assembler.Parameter(1); |
474 Node* context = assembler.Parameter(4); | 474 Node* context = assembler.Parameter(4); |
475 Node* result = assembler.OrdinaryHasInstance(context, f, v); | 475 Node* result = assembler.OrdinaryHasInstance(context, f, v); |
476 assembler.Return(result); | 476 assembler.Return(result); |
477 } | 477 } |
478 | 478 |
479 } // namespace internal | 479 } // namespace internal |
480 } // namespace v8 | 480 } // namespace v8 |
OLD | NEW |