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 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 __ Bind(&non_function_constructor); | 376 __ Bind(&non_function_constructor); |
377 { | 377 { |
378 return_value.Bind(__ LoadRoot(Heap::kObject_stringRootIndex)); | 378 return_value.Bind(__ LoadRoot(Heap::kObject_stringRootIndex)); |
379 __ Goto(&done); | 379 __ Goto(&done); |
380 } | 380 } |
381 | 381 |
382 __ Bind(&done); | 382 __ Bind(&done); |
383 return return_value.value(); | 383 return return_value.value(); |
384 } | 384 } |
385 | 385 |
| 386 Node* IntrinsicsHelper::CreateAsyncFromSyncIterator(Node* args_reg, |
| 387 Node* arg_count, |
| 388 Node* context) { |
| 389 InterpreterAssembler::Label not_receiver( |
| 390 assembler_, InterpreterAssembler::Label::kDeferred); |
| 391 InterpreterAssembler::Label done(assembler_); |
| 392 InterpreterAssembler::Variable return_value(assembler_, |
| 393 MachineRepresentation::kTagged); |
| 394 |
| 395 Node* sync_iterator = __ LoadRegister(args_reg); |
| 396 |
| 397 __ GotoIf(__ TaggedIsSmi(sync_iterator), ¬_receiver); |
| 398 __ GotoUnless(__ IsJSReceiver(sync_iterator), ¬_receiver); |
| 399 |
| 400 Node* const native_context = __ LoadNativeContext(context); |
| 401 Node* const map = __ LoadContextElement( |
| 402 native_context, Context::INITIAL_ASYNC_FROM_SYNC_ITERATOR_MAP_INDEX); |
| 403 Node* const iterator = __ AllocateJSObjectFromMap(map); |
| 404 |
| 405 __ StoreObjectFieldNoWriteBarrier( |
| 406 iterator, JSAsyncFromSyncIterator::kSyncIteratorOffset, sync_iterator); |
| 407 |
| 408 return_value.Bind(iterator); |
| 409 __ Goto(&done); |
| 410 |
| 411 __ Bind(¬_receiver); |
| 412 { |
| 413 return_value.Bind( |
| 414 __ CallRuntime(Runtime::kThrowSymbolIteratorInvalid, context)); |
| 415 __ Goto(&done); |
| 416 } |
| 417 |
| 418 __ Bind(&done); |
| 419 return return_value.value(); |
| 420 } |
| 421 |
386 void IntrinsicsHelper::AbortIfArgCountMismatch(int expected, Node* actual) { | 422 void IntrinsicsHelper::AbortIfArgCountMismatch(int expected, Node* actual) { |
387 InterpreterAssembler::Label match(assembler_); | 423 InterpreterAssembler::Label match(assembler_); |
388 Node* comparison = __ Word32Equal(actual, __ Int32Constant(expected)); | 424 Node* comparison = __ Word32Equal(actual, __ Int32Constant(expected)); |
389 __ GotoIf(comparison, &match); | 425 __ GotoIf(comparison, &match); |
390 __ Abort(kWrongArgumentCountForInvokeIntrinsic); | 426 __ Abort(kWrongArgumentCountForInvokeIntrinsic); |
391 __ Goto(&match); | 427 __ Goto(&match); |
392 __ Bind(&match); | 428 __ Bind(&match); |
393 } | 429 } |
394 | 430 |
395 } // namespace interpreter | 431 } // namespace interpreter |
396 } // namespace internal | 432 } // namespace internal |
397 } // namespace v8 | 433 } // namespace v8 |
OLD | NEW |