| 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 #include "src/code-stub-assembler.h" | 4 #include "src/code-stub-assembler.h" |
| 5 #include "src/code-factory.h" | 5 #include "src/code-factory.h" |
| 6 #include "src/frames-inl.h" | 6 #include "src/frames-inl.h" |
| 7 #include "src/frames.h" | 7 #include "src/frames.h" |
| 8 | 8 |
| 9 namespace v8 { | 9 namespace v8 { |
| 10 namespace internal { | 10 namespace internal { |
| (...skipping 3274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3285 | 3285 |
| 3286 // Int32 variables. | 3286 // Int32 variables. |
| 3287 Variable var_instance_type(this, MachineRepresentation::kWord32, int_zero); | 3287 Variable var_instance_type(this, MachineRepresentation::kWord32, int_zero); |
| 3288 Variable var_representation(this, MachineRepresentation::kWord32, int_zero); | 3288 Variable var_representation(this, MachineRepresentation::kWord32, int_zero); |
| 3289 | 3289 |
| 3290 Variable var_from(this, MachineRepresentation::kTagged, from); // Smi. | 3290 Variable var_from(this, MachineRepresentation::kTagged, from); // Smi. |
| 3291 Variable var_string(this, MachineRepresentation::kTagged, string); // String. | 3291 Variable var_string(this, MachineRepresentation::kTagged, string); // String. |
| 3292 Variable var_result(this, MachineRepresentation::kTagged); // String. | 3292 Variable var_result(this, MachineRepresentation::kTagged); // String. |
| 3293 | 3293 |
| 3294 // Make sure first argument is a string. | 3294 // Make sure first argument is a string. |
| 3295 | 3295 CSA_ASSERT(this, TaggedIsNotSmi(string)); |
| 3296 // Bailout if receiver is a Smi. | 3296 CSA_ASSERT(this, IsString(string)); |
| 3297 GotoIf(TaggedIsSmi(string), &runtime); | |
| 3298 | 3297 |
| 3299 // Load the instance type of the {string}. | 3298 // Load the instance type of the {string}. |
| 3300 Node* const instance_type = LoadInstanceType(string); | 3299 Node* const instance_type = LoadInstanceType(string); |
| 3301 var_instance_type.Bind(instance_type); | 3300 var_instance_type.Bind(instance_type); |
| 3302 | 3301 |
| 3303 // Check if {string} is a String. | |
| 3304 GotoUnless(IsStringInstanceType(instance_type), &runtime); | |
| 3305 | |
| 3306 // Make sure that both from and to are non-negative smis. | 3302 // Make sure that both from and to are non-negative smis. |
| 3307 | 3303 |
| 3308 GotoUnless(TaggedIsPositiveSmi(from), &runtime); | 3304 GotoUnless(TaggedIsPositiveSmi(from), &runtime); |
| 3309 GotoUnless(TaggedIsPositiveSmi(to), &runtime); | 3305 GotoUnless(TaggedIsPositiveSmi(to), &runtime); |
| 3310 | 3306 |
| 3311 Node* const substr_length = SmiSub(to, from); | 3307 Node* const substr_length = SmiSub(to, from); |
| 3312 Node* const string_length = LoadStringLength(string); | 3308 Node* const string_length = LoadStringLength(string); |
| 3313 | 3309 |
| 3314 // Begin dispatching based on substring length. | 3310 // Begin dispatching based on substring length. |
| 3315 | 3311 |
| (...skipping 5047 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8363 formatted.c_str(), TENURED); | 8359 formatted.c_str(), TENURED); |
| 8364 CallRuntime(Runtime::kGlobalPrint, NoContextConstant(), | 8360 CallRuntime(Runtime::kGlobalPrint, NoContextConstant(), |
| 8365 HeapConstant(string)); | 8361 HeapConstant(string)); |
| 8366 } | 8362 } |
| 8367 CallRuntime(Runtime::kDebugPrint, NoContextConstant(), tagged_value); | 8363 CallRuntime(Runtime::kDebugPrint, NoContextConstant(), tagged_value); |
| 8368 #endif | 8364 #endif |
| 8369 } | 8365 } |
| 8370 | 8366 |
| 8371 } // namespace internal | 8367 } // namespace internal |
| 8372 } // namespace v8 | 8368 } // namespace v8 |
| OLD | NEW |