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/interpreter/interpreter-intrinsics-generator.h" | 5 #include "src/interpreter/interpreter-intrinsics-generator.h" |
6 | 6 |
7 #include "src/allocation.h" | 7 #include "src/allocation.h" |
8 #include "src/builtins/builtins.h" | 8 #include "src/builtins/builtins.h" |
9 #include "src/code-factory.h" | 9 #include "src/code-factory.h" |
10 #include "src/frames.h" | 10 #include "src/frames.h" |
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
430 Node* generator = __ LoadRegister(args_reg); | 430 Node* generator = __ LoadRegister(args_reg); |
431 Node* const value = | 431 Node* const value = |
432 __ LoadObjectField(generator, JSGeneratorObject::kResumeModeOffset); | 432 __ LoadObjectField(generator, JSGeneratorObject::kResumeModeOffset); |
433 | 433 |
434 return value; | 434 return value; |
435 } | 435 } |
436 | 436 |
437 Node* IntrinsicsGenerator::GeneratorClose(Node* args_reg, Node* arg_count, | 437 Node* IntrinsicsGenerator::GeneratorClose(Node* args_reg, Node* arg_count, |
438 Node* context) { | 438 Node* context) { |
439 Node* generator = __ LoadRegister(args_reg); | 439 Node* generator = __ LoadRegister(args_reg); |
440 Node* const value = | |
441 __ LoadObjectField(generator, JSGeneratorObject::kResumeModeOffset); | |
442 __ StoreObjectFieldNoWriteBarrier( | 440 __ StoreObjectFieldNoWriteBarrier( |
443 generator, JSGeneratorObject::kContinuationOffset, | 441 generator, JSGeneratorObject::kContinuationOffset, |
444 __ SmiConstant(JSGeneratorObject::kGeneratorClosed)); | 442 __ SmiConstant(JSGeneratorObject::kGeneratorClosed)); |
445 | 443 return __ UndefinedConstant(); |
446 return value; | |
447 } | 444 } |
448 | 445 |
449 Node* IntrinsicsGenerator::AsyncGeneratorReject(Node* input, Node* arg_count, | 446 Node* IntrinsicsGenerator::AsyncGeneratorReject(Node* input, Node* arg_count, |
450 Node* context) { | 447 Node* context) { |
451 return IntrinsicAsBuiltinCall(input, context, | 448 return IntrinsicAsBuiltinCall(input, context, |
452 Builtins::kAsyncGeneratorReject); | 449 Builtins::kAsyncGeneratorReject); |
453 } | 450 } |
454 | 451 |
455 Node* IntrinsicsGenerator::AsyncGeneratorResolve(Node* input, Node* arg_count, | 452 Node* IntrinsicsGenerator::AsyncGeneratorResolve(Node* input, Node* arg_count, |
456 Node* context) { | 453 Node* context) { |
457 return IntrinsicAsBuiltinCall(input, context, | 454 return IntrinsicAsBuiltinCall(input, context, |
458 Builtins::kAsyncGeneratorResolve); | 455 Builtins::kAsyncGeneratorResolve); |
459 } | 456 } |
460 | 457 |
461 void IntrinsicsGenerator::AbortIfArgCountMismatch(int expected, Node* actual) { | 458 void IntrinsicsGenerator::AbortIfArgCountMismatch(int expected, Node* actual) { |
462 InterpreterAssembler::Label match(assembler_); | 459 InterpreterAssembler::Label match(assembler_); |
463 Node* comparison = __ Word32Equal(actual, __ Int32Constant(expected)); | 460 Node* comparison = __ Word32Equal(actual, __ Int32Constant(expected)); |
464 __ GotoIf(comparison, &match); | 461 __ GotoIf(comparison, &match); |
465 __ Abort(kWrongArgumentCountForInvokeIntrinsic); | 462 __ Abort(kWrongArgumentCountForInvokeIntrinsic); |
466 __ Goto(&match); | 463 __ Goto(&match); |
467 __ BIND(&match); | 464 __ BIND(&match); |
468 } | 465 } |
469 | 466 |
470 } // namespace interpreter | 467 } // namespace interpreter |
471 } // namespace internal | 468 } // namespace internal |
472 } // namespace v8 | 469 } // namespace v8 |
OLD | NEW |