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 #include "src/objects-inl.h" | 8 #include "src/objects-inl.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 TailCallMode::kDisallow); | 292 TailCallMode::kDisallow); |
293 return result; | 293 return result; |
294 } | 294 } |
295 | 295 |
296 Node* IntrinsicsHelper::ClassOf(Node* args_reg, Node* arg_count, | 296 Node* IntrinsicsHelper::ClassOf(Node* args_reg, Node* arg_count, |
297 Node* context) { | 297 Node* context) { |
298 Node* value = __ LoadRegister(args_reg); | 298 Node* value = __ LoadRegister(args_reg); |
299 return __ ClassOf(value); | 299 return __ ClassOf(value); |
300 } | 300 } |
301 | 301 |
| 302 Node* IntrinsicsHelper::CreateAsyncFromSyncIterator(Node* args_reg, |
| 303 Node* arg_count, |
| 304 Node* context) { |
| 305 InterpreterAssembler::Label not_receiver( |
| 306 assembler_, InterpreterAssembler::Label::kDeferred); |
| 307 InterpreterAssembler::Label done(assembler_); |
| 308 InterpreterAssembler::Variable return_value(assembler_, |
| 309 MachineRepresentation::kTagged); |
| 310 |
| 311 Node* sync_iterator = __ LoadRegister(args_reg); |
| 312 |
| 313 __ GotoIf(__ TaggedIsSmi(sync_iterator), ¬_receiver); |
| 314 __ GotoIfNot(__ IsJSReceiver(sync_iterator), ¬_receiver); |
| 315 |
| 316 Node* const native_context = __ LoadNativeContext(context); |
| 317 Node* const map = __ LoadContextElement( |
| 318 native_context, Context::ASYNC_FROM_SYNC_ITERATOR_MAP_INDEX); |
| 319 Node* const iterator = __ AllocateJSObjectFromMap(map); |
| 320 |
| 321 __ StoreObjectFieldNoWriteBarrier( |
| 322 iterator, JSAsyncFromSyncIterator::kSyncIteratorOffset, sync_iterator); |
| 323 |
| 324 return_value.Bind(iterator); |
| 325 __ Goto(&done); |
| 326 |
| 327 __ Bind(¬_receiver); |
| 328 { |
| 329 return_value.Bind( |
| 330 __ CallRuntime(Runtime::kThrowSymbolIteratorInvalid, context)); |
| 331 |
| 332 // Unreachable due to the Throw in runtime call. |
| 333 __ Goto(&done); |
| 334 } |
| 335 |
| 336 __ Bind(&done); |
| 337 return return_value.value(); |
| 338 } |
| 339 |
302 void IntrinsicsHelper::AbortIfArgCountMismatch(int expected, Node* actual) { | 340 void IntrinsicsHelper::AbortIfArgCountMismatch(int expected, Node* actual) { |
303 InterpreterAssembler::Label match(assembler_); | 341 InterpreterAssembler::Label match(assembler_); |
304 Node* comparison = __ Word32Equal(actual, __ Int32Constant(expected)); | 342 Node* comparison = __ Word32Equal(actual, __ Int32Constant(expected)); |
305 __ GotoIf(comparison, &match); | 343 __ GotoIf(comparison, &match); |
306 __ Abort(kWrongArgumentCountForInvokeIntrinsic); | 344 __ Abort(kWrongArgumentCountForInvokeIntrinsic); |
307 __ Goto(&match); | 345 __ Goto(&match); |
308 __ Bind(&match); | 346 __ Bind(&match); |
309 } | 347 } |
310 | 348 |
311 } // namespace interpreter | 349 } // namespace interpreter |
312 } // namespace internal | 350 } // namespace internal |
313 } // namespace v8 | 351 } // namespace v8 |
OLD | NEW |