| 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 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 TailCallMode::kDisallow); | 303 TailCallMode::kDisallow); |
| 304 return result; | 304 return result; |
| 305 } | 305 } |
| 306 | 306 |
| 307 Node* IntrinsicsHelper::ClassOf(Node* args_reg, Node* arg_count, | 307 Node* IntrinsicsHelper::ClassOf(Node* args_reg, Node* arg_count, |
| 308 Node* context) { | 308 Node* context) { |
| 309 Node* value = __ LoadRegister(args_reg); | 309 Node* value = __ LoadRegister(args_reg); |
| 310 return __ ClassOf(value); | 310 return __ ClassOf(value); |
| 311 } | 311 } |
| 312 | 312 |
| 313 Node* IntrinsicsHelper::CreateAsyncFromSyncIterator(Node* args_reg, |
| 314 Node* arg_count, |
| 315 Node* context) { |
| 316 InterpreterAssembler::Label not_receiver( |
| 317 assembler_, InterpreterAssembler::Label::kDeferred); |
| 318 InterpreterAssembler::Label done(assembler_); |
| 319 InterpreterAssembler::Variable return_value(assembler_, |
| 320 MachineRepresentation::kTagged); |
| 321 |
| 322 Node* sync_iterator = __ LoadRegister(args_reg); |
| 323 |
| 324 __ GotoIf(__ TaggedIsSmi(sync_iterator), ¬_receiver); |
| 325 __ GotoUnless(__ IsJSReceiver(sync_iterator), ¬_receiver); |
| 326 |
| 327 Node* const native_context = __ LoadNativeContext(context); |
| 328 Node* const map = __ LoadContextElement( |
| 329 native_context, Context::ASYNC_FROM_SYNC_ITERATOR_MAP_INDEX); |
| 330 Node* const iterator = __ AllocateJSObjectFromMap(map); |
| 331 |
| 332 __ StoreObjectFieldNoWriteBarrier( |
| 333 iterator, JSAsyncFromSyncIterator::kSyncIteratorOffset, sync_iterator); |
| 334 |
| 335 return_value.Bind(iterator); |
| 336 __ Goto(&done); |
| 337 |
| 338 __ Bind(¬_receiver); |
| 339 { |
| 340 return_value.Bind( |
| 341 __ CallRuntime(Runtime::kThrowSymbolIteratorInvalid, context)); |
| 342 __ Goto(&done); |
| 343 } |
| 344 |
| 345 __ Bind(&done); |
| 346 return return_value.value(); |
| 347 } |
| 348 |
| 313 void IntrinsicsHelper::AbortIfArgCountMismatch(int expected, Node* actual) { | 349 void IntrinsicsHelper::AbortIfArgCountMismatch(int expected, Node* actual) { |
| 314 InterpreterAssembler::Label match(assembler_); | 350 InterpreterAssembler::Label match(assembler_); |
| 315 Node* comparison = __ Word32Equal(actual, __ Int32Constant(expected)); | 351 Node* comparison = __ Word32Equal(actual, __ Int32Constant(expected)); |
| 316 __ GotoIf(comparison, &match); | 352 __ GotoIf(comparison, &match); |
| 317 __ Abort(kWrongArgumentCountForInvokeIntrinsic); | 353 __ Abort(kWrongArgumentCountForInvokeIntrinsic); |
| 318 __ Goto(&match); | 354 __ Goto(&match); |
| 319 __ Bind(&match); | 355 __ Bind(&match); |
| 320 } | 356 } |
| 321 | 357 |
| 322 } // namespace interpreter | 358 } // namespace interpreter |
| 323 } // namespace internal | 359 } // namespace internal |
| 324 } // namespace v8 | 360 } // namespace v8 |
| OLD | NEW |