Chromium Code Reviews| 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 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 398 | 398 |
| 399 return value; | 399 return value; |
| 400 } | 400 } |
| 401 | 401 |
| 402 Node* IntrinsicsGenerator::CreateJSGeneratorObject(Node* input, Node* arg_count, | 402 Node* IntrinsicsGenerator::CreateJSGeneratorObject(Node* input, Node* arg_count, |
| 403 Node* context) { | 403 Node* context) { |
| 404 return IntrinsicAsBuiltinCall(input, context, | 404 return IntrinsicAsBuiltinCall(input, context, |
| 405 Builtins::kCreateGeneratorObject); | 405 Builtins::kCreateGeneratorObject); |
| 406 } | 406 } |
| 407 | 407 |
| 408 Node* IntrinsicsGenerator::GeneratorGetContext(Node* args_reg, Node* arg_count, | |
| 409 Node* context) { | |
| 410 Node* generator = __ LoadRegister(args_reg); | |
| 411 Node* const value = | |
| 412 __ LoadObjectField(generator, JSGeneratorObject::kContextOffset); | |
|
rmcilroy
2017/05/17 14:48:28
Maybe there is a case for having a LoadObjectField
adamk
2017/05/17 17:35:31
I like this idea, I was curious why we didn't have
mvstanton
2017/05/18 10:00:59
I'm happy to take a run at it. There are probably
| |
| 413 | |
| 414 return value; | |
| 415 } | |
| 416 | |
| 417 Node* IntrinsicsGenerator::GeneratorGetInputOrDebugPos(Node* args_reg, | |
| 418 Node* arg_count, | |
| 419 Node* context) { | |
| 420 Node* generator = __ LoadRegister(args_reg); | |
| 421 Node* const value = | |
| 422 __ LoadObjectField(generator, JSGeneratorObject::kInputOrDebugPosOffset); | |
| 423 | |
| 424 return value; | |
| 425 } | |
| 426 | |
| 427 Node* IntrinsicsGenerator::GeneratorGetResumeMode(Node* args_reg, | |
| 428 Node* arg_count, | |
| 429 Node* context) { | |
| 430 Node* generator = __ LoadRegister(args_reg); | |
| 431 Node* const value = | |
| 432 __ LoadObjectField(generator, JSGeneratorObject::kResumeModeOffset); | |
| 433 | |
| 434 return value; | |
| 435 } | |
| 436 | |
| 408 Node* IntrinsicsGenerator::AsyncGeneratorReject(Node* input, Node* arg_count, | 437 Node* IntrinsicsGenerator::AsyncGeneratorReject(Node* input, Node* arg_count, |
| 409 Node* context) { | 438 Node* context) { |
| 410 return IntrinsicAsBuiltinCall(input, context, | 439 return IntrinsicAsBuiltinCall(input, context, |
| 411 Builtins::kAsyncGeneratorReject); | 440 Builtins::kAsyncGeneratorReject); |
| 412 } | 441 } |
| 413 | 442 |
| 414 Node* IntrinsicsGenerator::AsyncGeneratorResolve(Node* input, Node* arg_count, | 443 Node* IntrinsicsGenerator::AsyncGeneratorResolve(Node* input, Node* arg_count, |
| 415 Node* context) { | 444 Node* context) { |
| 416 return IntrinsicAsBuiltinCall(input, context, | 445 return IntrinsicAsBuiltinCall(input, context, |
| 417 Builtins::kAsyncGeneratorResolve); | 446 Builtins::kAsyncGeneratorResolve); |
| 418 } | 447 } |
| 419 | 448 |
| 420 void IntrinsicsGenerator::AbortIfArgCountMismatch(int expected, Node* actual) { | 449 void IntrinsicsGenerator::AbortIfArgCountMismatch(int expected, Node* actual) { |
| 421 InterpreterAssembler::Label match(assembler_); | 450 InterpreterAssembler::Label match(assembler_); |
| 422 Node* comparison = __ Word32Equal(actual, __ Int32Constant(expected)); | 451 Node* comparison = __ Word32Equal(actual, __ Int32Constant(expected)); |
| 423 __ GotoIf(comparison, &match); | 452 __ GotoIf(comparison, &match); |
| 424 __ Abort(kWrongArgumentCountForInvokeIntrinsic); | 453 __ Abort(kWrongArgumentCountForInvokeIntrinsic); |
| 425 __ Goto(&match); | 454 __ Goto(&match); |
| 426 __ Bind(&match); | 455 __ Bind(&match); |
| 427 } | 456 } |
| 428 | 457 |
| 429 } // namespace interpreter | 458 } // namespace interpreter |
| 430 } // namespace internal | 459 } // namespace internal |
| 431 } // namespace v8 | 460 } // namespace v8 |
| OLD | NEW |