OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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.h" | 5 #include "src/interpreter/interpreter-intrinsics.h" |
6 | 6 |
7 #include "src/code-factory.h" | 7 #include "src/code-factory.h" |
8 | 8 |
9 namespace v8 { | 9 namespace v8 { |
10 namespace internal { | 10 namespace internal { |
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 __ Bind(&non_function_constructor); | 382 __ Bind(&non_function_constructor); |
383 { | 383 { |
384 return_value.Bind(__ LoadRoot(Heap::kObject_stringRootIndex)); | 384 return_value.Bind(__ LoadRoot(Heap::kObject_stringRootIndex)); |
385 __ Goto(&done); | 385 __ Goto(&done); |
386 } | 386 } |
387 | 387 |
388 __ Bind(&done); | 388 __ Bind(&done); |
389 return return_value.value(); | 389 return return_value.value(); |
390 } | 390 } |
391 | 391 |
| 392 Node* IntrinsicsHelper::CreateAsyncFromSyncIterator(Node* args_reg, |
| 393 Node* arg_count, |
| 394 Node* context) { |
| 395 InterpreterAssembler::Label not_receiver( |
| 396 assembler_, InterpreterAssembler::Label::kDeferred); |
| 397 InterpreterAssembler::Label done(assembler_); |
| 398 InterpreterAssembler::Variable return_value(assembler_, |
| 399 MachineRepresentation::kTagged); |
| 400 |
| 401 Node* sync_iterator = __ LoadRegister(args_reg); |
| 402 |
| 403 __ GotoIf(__ TaggedIsSmi(sync_iterator), ¬_receiver); |
| 404 __ GotoUnless(__ IsJSReceiver(sync_iterator), ¬_receiver); |
| 405 |
| 406 Node* const native_context = __ LoadNativeContext(context); |
| 407 Node* const map = __ LoadContextElement( |
| 408 native_context, Context::INITIAL_ASYNC_FROM_SYNC_ITERATOR_MAP_INDEX); |
| 409 Node* const iterator = __ AllocateJSObjectFromMap(map); |
| 410 |
| 411 __ StoreObjectFieldNoWriteBarrier( |
| 412 iterator, JSAsyncFromSyncIterator::kSyncIteratorOffset, sync_iterator); |
| 413 |
| 414 return_value.Bind(iterator); |
| 415 __ Goto(&done); |
| 416 |
| 417 __ Bind(¬_receiver); |
| 418 { |
| 419 return_value.Bind( |
| 420 __ CallRuntime(Runtime::kThrowSymbolIteratorInvalid, context)); |
| 421 __ Goto(&done); |
| 422 } |
| 423 |
| 424 __ Bind(&done); |
| 425 return return_value.value(); |
| 426 } |
| 427 |
392 void IntrinsicsHelper::AbortIfArgCountMismatch(int expected, Node* actual) { | 428 void IntrinsicsHelper::AbortIfArgCountMismatch(int expected, Node* actual) { |
393 InterpreterAssembler::Label match(assembler_); | 429 InterpreterAssembler::Label match(assembler_); |
394 Node* comparison = __ Word32Equal(actual, __ Int32Constant(expected)); | 430 Node* comparison = __ Word32Equal(actual, __ Int32Constant(expected)); |
395 __ GotoIf(comparison, &match); | 431 __ GotoIf(comparison, &match); |
396 __ Abort(kWrongArgumentCountForInvokeIntrinsic); | 432 __ Abort(kWrongArgumentCountForInvokeIntrinsic); |
397 __ Goto(&match); | 433 __ Goto(&match); |
398 __ Bind(&match); | 434 __ Bind(&match); |
399 } | 435 } |
400 | 436 |
401 } // namespace interpreter | 437 } // namespace interpreter |
402 } // namespace internal | 438 } // namespace internal |
403 } // namespace v8 | 439 } // namespace v8 |
OLD | NEW |