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 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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.Uint32LessThanOrEqual(argc, assembler.Int32Constant(1)), | 370 assembler.Uint32LessThanOrEqual(argc, assembler.Int32Constant(1)), |
371 &empty_arguments); | 371 &empty_arguments); |
372 Node* elements_length = assembler.ChangeUint32ToWord( | 372 Node* elements_length = assembler.ChangeUint32ToWord( |
373 assembler.Int32Sub(argc, assembler.Int32Constant(1))); | 373 assembler.Int32Sub(argc, assembler.Int32Constant(1))); |
374 Node* elements = assembler.AllocateFixedArray( | 374 Node* elements = assembler.AllocateFixedArray(FAST_ELEMENTS, elements_length); |
375 FAST_ELEMENTS, elements_length, CodeStubAssembler::INTPTR_PARAMETERS); | |
376 Variable index(&assembler, MachineType::PointerRepresentation()); | 375 Variable index(&assembler, MachineType::PointerRepresentation()); |
377 index.Bind(assembler.IntPtrConstant(0)); | 376 index.Bind(assembler.IntPtrConstant(0)); |
378 CodeStubAssembler::VariableList foreach_vars({&index}, assembler.zone()); | 377 CodeStubAssembler::VariableList foreach_vars({&index}, assembler.zone()); |
379 args.ForEach(foreach_vars, | 378 args.ForEach(foreach_vars, |
380 [&assembler, elements, &index](compiler::Node* arg) { | 379 [&assembler, elements, &index](compiler::Node* arg) { |
381 assembler.StoreFixedArrayElement( | 380 assembler.StoreFixedArrayElement(elements, index.value(), arg); |
382 elements, index.value(), arg, UPDATE_WRITE_BARRIER, 0, | |
383 CodeStubAssembler::INTPTR_PARAMETERS); | |
384 assembler.Increment(index); | 381 assembler.Increment(index); |
385 }, | 382 }, |
386 assembler.IntPtrConstant(1)); | 383 assembler.IntPtrConstant(1)); |
387 argument_array.Bind(elements); | 384 argument_array.Bind(elements); |
388 assembler.Goto(&arguments_done); | 385 assembler.Goto(&arguments_done); |
389 | 386 |
390 assembler.Bind(&empty_arguments); | 387 assembler.Bind(&empty_arguments); |
391 argument_array.Bind(assembler.EmptyFixedArrayConstant()); | 388 argument_array.Bind(assembler.EmptyFixedArrayConstant()); |
392 assembler.Goto(&arguments_done); | 389 assembler.Goto(&arguments_done); |
393 | 390 |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
471 | 468 |
472 Node* f = assembler.Parameter(0); | 469 Node* f = assembler.Parameter(0); |
473 Node* v = assembler.Parameter(1); | 470 Node* v = assembler.Parameter(1); |
474 Node* context = assembler.Parameter(4); | 471 Node* context = assembler.Parameter(4); |
475 Node* result = assembler.OrdinaryHasInstance(context, f, v); | 472 Node* result = assembler.OrdinaryHasInstance(context, f, v); |
476 assembler.Return(result); | 473 assembler.Return(result); |
477 } | 474 } |
478 | 475 |
479 } // namespace internal | 476 } // namespace internal |
480 } // namespace v8 | 477 } // namespace v8 |
OLD | NEW |