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); | |
|
neis
2017/02/20 11:27:59
IsJSReceiver already does this.
caitp
2017/02/20 17:09:35
```
Node* CodeStubAssembler::IsJSReceiver(Node* ob
neis
2017/02/20 18:26:54
Sorry, I thought you were using the version define
caitp
2017/02/20 20:09:19
Acknowledged.
| |
| 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)); | |
| 330 | |
| 331 // Unreachable due to the Throw in runtime call. | |
| 332 __ Goto(&done); | |
| 333 } | |
| 334 | |
| 335 __ Bind(&done); | |
| 336 return return_value.value(); | |
| 337 } | |
| 338 | |
| 301 void IntrinsicsHelper::AbortIfArgCountMismatch(int expected, Node* actual) { | 339 void IntrinsicsHelper::AbortIfArgCountMismatch(int expected, Node* actual) { |
| 302 InterpreterAssembler::Label match(assembler_); | 340 InterpreterAssembler::Label match(assembler_); |
| 303 Node* comparison = __ Word32Equal(actual, __ Int32Constant(expected)); | 341 Node* comparison = __ Word32Equal(actual, __ Int32Constant(expected)); |
| 304 __ GotoIf(comparison, &match); | 342 __ GotoIf(comparison, &match); |
| 305 __ Abort(kWrongArgumentCountForInvokeIntrinsic); | 343 __ Abort(kWrongArgumentCountForInvokeIntrinsic); |
| 306 __ Goto(&match); | 344 __ Goto(&match); |
| 307 __ Bind(&match); | 345 __ Bind(&match); |
| 308 } | 346 } |
| 309 | 347 |
| 310 } // namespace interpreter | 348 } // namespace interpreter |
| 311 } // namespace internal | 349 } // namespace internal |
| 312 } // namespace v8 | 350 } // namespace v8 |
| OLD | NEW |