OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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/code-stub-assembler.h" | 5 #include "src/code-stub-assembler.h" |
6 #include "src/code-factory.h" | 6 #include "src/code-factory.h" |
7 #include "src/frames-inl.h" | 7 #include "src/frames-inl.h" |
8 #include "src/frames.h" | 8 #include "src/frames.h" |
9 #include "src/ic/handler-configuration.h" | 9 #include "src/ic/handler-configuration.h" |
10 #include "src/ic/stub-cache.h" | 10 #include "src/ic/stub-cache.h" |
(...skipping 2363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2374 Bind(&runtime); | 2374 Bind(&runtime); |
2375 { | 2375 { |
2376 var_result.Bind(CallRuntime(Runtime::kStringToNumber, context, input)); | 2376 var_result.Bind(CallRuntime(Runtime::kStringToNumber, context, input)); |
2377 Goto(&end); | 2377 Goto(&end); |
2378 } | 2378 } |
2379 | 2379 |
2380 Bind(&end); | 2380 Bind(&end); |
2381 return var_result.value(); | 2381 return var_result.value(); |
2382 } | 2382 } |
2383 | 2383 |
| 2384 Node* CodeStubAssembler::ToName(Node* context, Node* value) { |
| 2385 typedef CodeStubAssembler::Label Label; |
| 2386 typedef CodeStubAssembler::Variable Variable; |
| 2387 |
| 2388 Label end(this); |
| 2389 Variable var_result(this, MachineRepresentation::kTagged); |
| 2390 |
| 2391 Label is_number(this); |
| 2392 GotoIf(WordIsSmi(value), &is_number); |
| 2393 |
| 2394 Label not_name(this); |
| 2395 Node* value_instance_type = LoadInstanceType(value); |
| 2396 STATIC_ASSERT(FIRST_NAME_TYPE == FIRST_TYPE); |
| 2397 GotoIf(Int32GreaterThan(value_instance_type, Int32Constant(LAST_NAME_TYPE)), |
| 2398 ¬_name); |
| 2399 |
| 2400 var_result.Bind(value); |
| 2401 Goto(&end); |
| 2402 |
| 2403 Bind(&is_number); |
| 2404 { |
| 2405 Callable callable = CodeFactory::NumberToString(isolate()); |
| 2406 var_result.Bind(CallStub(callable, context, value)); |
| 2407 Goto(&end); |
| 2408 } |
| 2409 |
| 2410 Bind(¬_name); |
| 2411 { |
| 2412 GotoIf(Word32Equal(value_instance_type, Int32Constant(HEAP_NUMBER_TYPE)), |
| 2413 &is_number); |
| 2414 |
| 2415 Label not_oddball(this); |
| 2416 GotoIf(Word32NotEqual(value_instance_type, Int32Constant(ODDBALL_TYPE)), |
| 2417 ¬_oddball); |
| 2418 |
| 2419 var_result.Bind(LoadObjectField(value, Oddball::kToStringOffset)); |
| 2420 Goto(&end); |
| 2421 |
| 2422 Bind(¬_oddball); |
| 2423 { |
| 2424 var_result.Bind(CallRuntime(Runtime::kToName, context, value)); |
| 2425 Goto(&end); |
| 2426 } |
| 2427 } |
| 2428 |
| 2429 Bind(&end); |
| 2430 return var_result.value(); |
| 2431 } |
| 2432 |
2384 Node* CodeStubAssembler::BitFieldDecode(Node* word32, uint32_t shift, | 2433 Node* CodeStubAssembler::BitFieldDecode(Node* word32, uint32_t shift, |
2385 uint32_t mask) { | 2434 uint32_t mask) { |
2386 return Word32Shr(Word32And(word32, Int32Constant(mask)), | 2435 return Word32Shr(Word32And(word32, Int32Constant(mask)), |
2387 static_cast<int>(shift)); | 2436 static_cast<int>(shift)); |
2388 } | 2437 } |
2389 | 2438 |
2390 void CodeStubAssembler::SetCounter(StatsCounter* counter, int value) { | 2439 void CodeStubAssembler::SetCounter(StatsCounter* counter, int value) { |
2391 if (FLAG_native_code_counters && counter->Enabled()) { | 2440 if (FLAG_native_code_counters && counter->Enabled()) { |
2392 Node* counter_address = ExternalConstant(ExternalReference(counter)); | 2441 Node* counter_address = ExternalConstant(ExternalReference(counter)); |
2393 StoreNoWriteBarrier(MachineRepresentation::kWord32, counter_address, | 2442 StoreNoWriteBarrier(MachineRepresentation::kWord32, counter_address, |
(...skipping 1948 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4342 Heap::kTheHoleValueRootIndex); | 4391 Heap::kTheHoleValueRootIndex); |
4343 | 4392 |
4344 // Store the WeakCell in the feedback vector. | 4393 // Store the WeakCell in the feedback vector. |
4345 StoreFixedArrayElement(feedback_vector, slot, cell, UPDATE_WRITE_BARRIER, | 4394 StoreFixedArrayElement(feedback_vector, slot, cell, UPDATE_WRITE_BARRIER, |
4346 CodeStubAssembler::SMI_PARAMETERS); | 4395 CodeStubAssembler::SMI_PARAMETERS); |
4347 return cell; | 4396 return cell; |
4348 } | 4397 } |
4349 | 4398 |
4350 } // namespace internal | 4399 } // namespace internal |
4351 } // namespace v8 | 4400 } // namespace v8 |
OLD | NEW |