Chromium Code Reviews| 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 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 291 TailCallMode::kDisallow); | 291 TailCallMode::kDisallow); |
| 292 return result; | 292 return result; |
| 293 } | 293 } |
| 294 | 294 |
| 295 Node* IntrinsicsHelper::ClassOf(Node* args_reg, Node* arg_count, | 295 Node* IntrinsicsHelper::ClassOf(Node* args_reg, Node* arg_count, |
| 296 Node* context) { | 296 Node* context) { |
| 297 Node* value = __ LoadRegister(args_reg); | 297 Node* value = __ LoadRegister(args_reg); |
| 298 return __ ClassOf(value); | 298 return __ ClassOf(value); |
| 299 } | 299 } |
| 300 | 300 |
| 301 Node* IntrinsicsHelper::CreateAsyncFromSyncIterator(Node* args_reg, | |
| 302 Node* arg_count, | |
| 303 Node* context) { | |
| 304 InterpreterAssembler::Label not_receiver( | |
| 305 assembler_, InterpreterAssembler::Label::kDeferred); | |
| 306 InterpreterAssembler::Label done(assembler_); | |
| 307 InterpreterAssembler::Variable return_value(assembler_, | |
| 308 MachineRepresentation::kTagged); | |
| 309 | |
| 310 Node* sync_iterator = __ LoadRegister(args_reg); | |
| 311 | |
| 312 __ GotoIf(__ TaggedIsSmi(sync_iterator), ¬_receiver); | |
| 313 __ GotoUnless(__ IsJSReceiver(sync_iterator), ¬_receiver); | |
| 314 | |
| 315 Node* const native_context = __ LoadNativeContext(context); | |
| 316 Node* const map = __ LoadContextElement( | |
| 317 native_context, Context::ASYNC_FROM_SYNC_ITERATOR_MAP_INDEX); | |
| 318 Node* const iterator = __ AllocateJSObjectFromMap(map); | |
| 319 | |
| 320 __ StoreObjectFieldNoWriteBarrier( | |
| 321 iterator, JSAsyncFromSyncIterator::kSyncIteratorOffset, sync_iterator); | |
| 322 | |
| 323 return_value.Bind(iterator); | |
| 324 __ Goto(&done); | |
| 325 | |
| 326 __ Bind(¬_receiver); | |
| 327 { | |
| 328 return_value.Bind( | |
| 329 __ CallRuntime(Runtime::kThrowSymbolIteratorInvalid, context)); | |
|
jgruber
2017/02/17 12:28:23
Can we TailCallRuntime from here (v8:5939)?. Other
caitp
2017/02/17 14:56:11
Done.
| |
| 330 __ Goto(&done); | |
| 331 } | |
| 332 | |
| 333 __ Bind(&done); | |
| 334 return return_value.value(); | |
| 335 } | |
| 336 | |
| 301 void IntrinsicsHelper::AbortIfArgCountMismatch(int expected, Node* actual) { | 337 void IntrinsicsHelper::AbortIfArgCountMismatch(int expected, Node* actual) { |
| 302 InterpreterAssembler::Label match(assembler_); | 338 InterpreterAssembler::Label match(assembler_); |
| 303 Node* comparison = __ Word32Equal(actual, __ Int32Constant(expected)); | 339 Node* comparison = __ Word32Equal(actual, __ Int32Constant(expected)); |
| 304 __ GotoIf(comparison, &match); | 340 __ GotoIf(comparison, &match); |
| 305 __ Abort(kWrongArgumentCountForInvokeIntrinsic); | 341 __ Abort(kWrongArgumentCountForInvokeIntrinsic); |
| 306 __ Goto(&match); | 342 __ Goto(&match); |
| 307 __ Bind(&match); | 343 __ Bind(&match); |
| 308 } | 344 } |
| 309 | 345 |
| 310 } // namespace interpreter | 346 } // namespace interpreter |
| 311 } // namespace internal | 347 } // namespace internal |
| 312 } // namespace v8 | 348 } // namespace v8 |
| OLD | NEW |