Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1072)

Side by Side Diff: src/arm/code-stubs-arm.cc

Issue 346413004: Remove distinction between hidden and normal runtime functions (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix natives fuzzing Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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/v8.h" 5 #include "src/v8.h"
6 6
7 #if V8_TARGET_ARCH_ARM 7 #if V8_TARGET_ARCH_ARM
8 8
9 #include "src/bootstrapper.h" 9 #include "src/bootstrapper.h"
10 #include "src/code-stubs.h" 10 #include "src/code-stubs.h"
11 #include "src/regexp-macro-assembler.h" 11 #include "src/regexp-macro-assembler.h"
12 #include "src/stub-cache.h" 12 #include "src/stub-cache.h"
13 13
14 namespace v8 { 14 namespace v8 {
15 namespace internal { 15 namespace internal {
16 16
17 17
18 void FastNewClosureStub::InitializeInterfaceDescriptor( 18 void FastNewClosureStub::InitializeInterfaceDescriptor(
19 CodeStubInterfaceDescriptor* descriptor) { 19 CodeStubInterfaceDescriptor* descriptor) {
20 static Register registers[] = { r2 }; 20 static Register registers[] = { r2 };
21 descriptor->register_param_count_ = 1; 21 descriptor->register_param_count_ = 1;
22 descriptor->register_params_ = registers; 22 descriptor->register_params_ = registers;
23 descriptor->deoptimization_handler_ = 23 descriptor->deoptimization_handler_ =
24 Runtime::FunctionForId(Runtime::kHiddenNewClosureFromStubFailure)->entry; 24 Runtime::FunctionForId(Runtime::kNewClosureFromStubFailure)->entry;
25 } 25 }
26 26
27 27
28 void FastNewContextStub::InitializeInterfaceDescriptor( 28 void FastNewContextStub::InitializeInterfaceDescriptor(
29 CodeStubInterfaceDescriptor* descriptor) { 29 CodeStubInterfaceDescriptor* descriptor) {
30 static Register registers[] = { r1 }; 30 static Register registers[] = { r1 };
31 descriptor->register_param_count_ = 1; 31 descriptor->register_param_count_ = 1;
32 descriptor->register_params_ = registers; 32 descriptor->register_params_ = registers;
33 descriptor->deoptimization_handler_ = NULL; 33 descriptor->deoptimization_handler_ = NULL;
34 } 34 }
35 35
36 36
37 void ToNumberStub::InitializeInterfaceDescriptor( 37 void ToNumberStub::InitializeInterfaceDescriptor(
38 CodeStubInterfaceDescriptor* descriptor) { 38 CodeStubInterfaceDescriptor* descriptor) {
39 static Register registers[] = { r0 }; 39 static Register registers[] = { r0 };
40 descriptor->register_param_count_ = 1; 40 descriptor->register_param_count_ = 1;
41 descriptor->register_params_ = registers; 41 descriptor->register_params_ = registers;
42 descriptor->deoptimization_handler_ = NULL; 42 descriptor->deoptimization_handler_ = NULL;
43 } 43 }
44 44
45 45
46 void NumberToStringStub::InitializeInterfaceDescriptor( 46 void NumberToStringStub::InitializeInterfaceDescriptor(
47 CodeStubInterfaceDescriptor* descriptor) { 47 CodeStubInterfaceDescriptor* descriptor) {
48 static Register registers[] = { r0 }; 48 static Register registers[] = { r0 };
49 descriptor->register_param_count_ = 1; 49 descriptor->register_param_count_ = 1;
50 descriptor->register_params_ = registers; 50 descriptor->register_params_ = registers;
51 descriptor->deoptimization_handler_ = 51 descriptor->deoptimization_handler_ =
52 Runtime::FunctionForId(Runtime::kHiddenNumberToString)->entry; 52 Runtime::FunctionForId(Runtime::kNumberToStringRT)->entry;
53 } 53 }
54 54
55 55
56 void FastCloneShallowArrayStub::InitializeInterfaceDescriptor( 56 void FastCloneShallowArrayStub::InitializeInterfaceDescriptor(
57 CodeStubInterfaceDescriptor* descriptor) { 57 CodeStubInterfaceDescriptor* descriptor) {
58 static Register registers[] = { r3, r2, r1 }; 58 static Register registers[] = { r3, r2, r1 };
59 descriptor->register_param_count_ = 3; 59 descriptor->register_param_count_ = 3;
60 descriptor->register_params_ = registers; 60 descriptor->register_params_ = registers;
61 static Representation representations[] = { 61 static Representation representations[] = {
62 Representation::Tagged(), 62 Representation::Tagged(),
63 Representation::Smi(), 63 Representation::Smi(),
64 Representation::Tagged() }; 64 Representation::Tagged() };
65 descriptor->register_param_representations_ = representations; 65 descriptor->register_param_representations_ = representations;
66 descriptor->deoptimization_handler_ = 66 descriptor->deoptimization_handler_ =
67 Runtime::FunctionForId( 67 Runtime::FunctionForId(Runtime::kCreateArrayLiteralStubBailout)->entry;
68 Runtime::kHiddenCreateArrayLiteralStubBailout)->entry;
69 } 68 }
70 69
71 70
72 void FastCloneShallowObjectStub::InitializeInterfaceDescriptor( 71 void FastCloneShallowObjectStub::InitializeInterfaceDescriptor(
73 CodeStubInterfaceDescriptor* descriptor) { 72 CodeStubInterfaceDescriptor* descriptor) {
74 static Register registers[] = { r3, r2, r1, r0 }; 73 static Register registers[] = { r3, r2, r1, r0 };
75 descriptor->register_param_count_ = 4; 74 descriptor->register_param_count_ = 4;
76 descriptor->register_params_ = registers; 75 descriptor->register_params_ = registers;
77 descriptor->deoptimization_handler_ = 76 descriptor->deoptimization_handler_ =
78 Runtime::FunctionForId(Runtime::kHiddenCreateObjectLiteral)->entry; 77 Runtime::FunctionForId(Runtime::kCreateObjectLiteral)->entry;
79 } 78 }
80 79
81 80
82 void CreateAllocationSiteStub::InitializeInterfaceDescriptor( 81 void CreateAllocationSiteStub::InitializeInterfaceDescriptor(
83 CodeStubInterfaceDescriptor* descriptor) { 82 CodeStubInterfaceDescriptor* descriptor) {
84 static Register registers[] = { r2, r3 }; 83 static Register registers[] = { r2, r3 };
85 descriptor->register_param_count_ = 2; 84 descriptor->register_param_count_ = 2;
86 descriptor->register_params_ = registers; 85 descriptor->register_params_ = registers;
87 descriptor->deoptimization_handler_ = NULL; 86 descriptor->deoptimization_handler_ = NULL;
88 } 87 }
(...skipping 18 matching lines...) Expand all
107 FUNCTION_ADDR(KeyedLoadIC_MissFromStubFailure); 106 FUNCTION_ADDR(KeyedLoadIC_MissFromStubFailure);
108 } 107 }
109 108
110 109
111 void RegExpConstructResultStub::InitializeInterfaceDescriptor( 110 void RegExpConstructResultStub::InitializeInterfaceDescriptor(
112 CodeStubInterfaceDescriptor* descriptor) { 111 CodeStubInterfaceDescriptor* descriptor) {
113 static Register registers[] = { r2, r1, r0 }; 112 static Register registers[] = { r2, r1, r0 };
114 descriptor->register_param_count_ = 3; 113 descriptor->register_param_count_ = 3;
115 descriptor->register_params_ = registers; 114 descriptor->register_params_ = registers;
116 descriptor->deoptimization_handler_ = 115 descriptor->deoptimization_handler_ =
117 Runtime::FunctionForId(Runtime::kHiddenRegExpConstructResult)->entry; 116 Runtime::FunctionForId(Runtime::kRegExpConstructResult)->entry;
118 } 117 }
119 118
120 119
121 void KeyedLoadGenericElementStub::InitializeInterfaceDescriptor( 120 void KeyedLoadGenericElementStub::InitializeInterfaceDescriptor(
122 CodeStubInterfaceDescriptor* descriptor) { 121 CodeStubInterfaceDescriptor* descriptor) {
123 static Register registers[] = { r1, r0 }; 122 static Register registers[] = { r1, r0 };
124 descriptor->register_param_count_ = 2; 123 descriptor->register_param_count_ = 2;
125 descriptor->register_params_ = registers; 124 descriptor->register_params_ = registers;
126 descriptor->deoptimization_handler_ = 125 descriptor->deoptimization_handler_ =
127 Runtime::FunctionForId(Runtime::kKeyedGetProperty)->entry; 126 Runtime::FunctionForId(Runtime::kKeyedGetProperty)->entry;
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 static Representation representations[] = { 218 static Representation representations[] = {
220 Representation::Tagged(), 219 Representation::Tagged(),
221 Representation::Tagged(), 220 Representation::Tagged(),
222 Representation::Integer32() }; 221 Representation::Integer32() };
223 descriptor->register_param_representations_ = representations; 222 descriptor->register_param_representations_ = representations;
224 } 223 }
225 224
226 descriptor->hint_stack_parameter_count_ = constant_stack_parameter_count; 225 descriptor->hint_stack_parameter_count_ = constant_stack_parameter_count;
227 descriptor->function_mode_ = JS_FUNCTION_STUB_MODE; 226 descriptor->function_mode_ = JS_FUNCTION_STUB_MODE;
228 descriptor->deoptimization_handler_ = 227 descriptor->deoptimization_handler_ =
229 Runtime::FunctionForId(Runtime::kHiddenArrayConstructor)->entry; 228 Runtime::FunctionForId(Runtime::kArrayConstructor)->entry;
230 } 229 }
231 230
232 231
233 static void InitializeInternalArrayConstructorDescriptor( 232 static void InitializeInternalArrayConstructorDescriptor(
234 CodeStubInterfaceDescriptor* descriptor, 233 CodeStubInterfaceDescriptor* descriptor,
235 int constant_stack_parameter_count) { 234 int constant_stack_parameter_count) {
236 // register state 235 // register state
237 // r0 -- number of arguments 236 // r0 -- number of arguments
238 // r1 -- constructor function 237 // r1 -- constructor function
239 static Register registers_variable_args[] = { r1, r0 }; 238 static Register registers_variable_args[] = { r1, r0 };
(...skipping 10 matching lines...) Expand all
250 descriptor->register_params_ = registers_variable_args; 249 descriptor->register_params_ = registers_variable_args;
251 static Representation representations[] = { 250 static Representation representations[] = {
252 Representation::Tagged(), 251 Representation::Tagged(),
253 Representation::Integer32() }; 252 Representation::Integer32() };
254 descriptor->register_param_representations_ = representations; 253 descriptor->register_param_representations_ = representations;
255 } 254 }
256 255
257 descriptor->hint_stack_parameter_count_ = constant_stack_parameter_count; 256 descriptor->hint_stack_parameter_count_ = constant_stack_parameter_count;
258 descriptor->function_mode_ = JS_FUNCTION_STUB_MODE; 257 descriptor->function_mode_ = JS_FUNCTION_STUB_MODE;
259 descriptor->deoptimization_handler_ = 258 descriptor->deoptimization_handler_ =
260 Runtime::FunctionForId(Runtime::kHiddenInternalArrayConstructor)->entry; 259 Runtime::FunctionForId(Runtime::kInternalArrayConstructor)->entry;
261 } 260 }
262 261
263 262
264 void ArrayNoArgumentConstructorStub::InitializeInterfaceDescriptor( 263 void ArrayNoArgumentConstructorStub::InitializeInterfaceDescriptor(
265 CodeStubInterfaceDescriptor* descriptor) { 264 CodeStubInterfaceDescriptor* descriptor) {
266 InitializeArrayConstructorDescriptor(descriptor, 0); 265 InitializeArrayConstructorDescriptor(descriptor, 0);
267 } 266 }
268 267
269 268
270 void ArraySingleArgumentConstructorStub::InitializeInterfaceDescriptor( 269 void ArraySingleArgumentConstructorStub::InitializeInterfaceDescriptor(
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 FUNCTION_ADDR(BinaryOpIC_MissWithAllocationSite); 348 FUNCTION_ADDR(BinaryOpIC_MissWithAllocationSite);
350 } 349 }
351 350
352 351
353 void StringAddStub::InitializeInterfaceDescriptor( 352 void StringAddStub::InitializeInterfaceDescriptor(
354 CodeStubInterfaceDescriptor* descriptor) { 353 CodeStubInterfaceDescriptor* descriptor) {
355 static Register registers[] = { r1, r0 }; 354 static Register registers[] = { r1, r0 };
356 descriptor->register_param_count_ = 2; 355 descriptor->register_param_count_ = 2;
357 descriptor->register_params_ = registers; 356 descriptor->register_params_ = registers;
358 descriptor->deoptimization_handler_ = 357 descriptor->deoptimization_handler_ =
359 Runtime::FunctionForId(Runtime::kHiddenStringAdd)->entry; 358 Runtime::FunctionForId(Runtime::kStringAdd)->entry;
360 } 359 }
361 360
362 361
363 void CallDescriptors::InitializeForIsolate(Isolate* isolate) { 362 void CallDescriptors::InitializeForIsolate(Isolate* isolate) {
364 static PlatformCallInterfaceDescriptor default_descriptor = 363 static PlatformCallInterfaceDescriptor default_descriptor =
365 PlatformCallInterfaceDescriptor(CAN_INLINE_TARGET_ADDRESS); 364 PlatformCallInterfaceDescriptor(CAN_INLINE_TARGET_ADDRESS);
366 365
367 static PlatformCallInterfaceDescriptor noInlineDescriptor = 366 static PlatformCallInterfaceDescriptor noInlineDescriptor =
368 PlatformCallInterfaceDescriptor(NEVER_INLINE_TARGET_ADDRESS); 367 PlatformCallInterfaceDescriptor(NEVER_INLINE_TARGET_ADDRESS);
369 368
(...skipping 1022 matching lines...) Expand 10 before | Expand all | Expand 10 after
1392 // double_exponent may not containe the exponent value if the input was a 1391 // double_exponent may not containe the exponent value if the input was a
1393 // smi. We set it with exponent value before bailing out. 1392 // smi. We set it with exponent value before bailing out.
1394 __ vmov(single_scratch, exponent); 1393 __ vmov(single_scratch, exponent);
1395 __ vcvt_f64_s32(double_exponent, single_scratch); 1394 __ vcvt_f64_s32(double_exponent, single_scratch);
1396 1395
1397 // Returning or bailing out. 1396 // Returning or bailing out.
1398 Counters* counters = isolate()->counters(); 1397 Counters* counters = isolate()->counters();
1399 if (exponent_type_ == ON_STACK) { 1398 if (exponent_type_ == ON_STACK) {
1400 // The arguments are still on the stack. 1399 // The arguments are still on the stack.
1401 __ bind(&call_runtime); 1400 __ bind(&call_runtime);
1402 __ TailCallRuntime(Runtime::kHiddenMathPow, 2, 1); 1401 __ TailCallRuntime(Runtime::kMathPowRT, 2, 1);
1403 1402
1404 // The stub is called from non-optimized code, which expects the result 1403 // The stub is called from non-optimized code, which expects the result
1405 // as heap number in exponent. 1404 // as heap number in exponent.
1406 __ bind(&done); 1405 __ bind(&done);
1407 __ AllocateHeapNumber( 1406 __ AllocateHeapNumber(
1408 heapnumber, scratch, scratch2, heapnumbermap, &call_runtime); 1407 heapnumber, scratch, scratch2, heapnumbermap, &call_runtime);
1409 __ vstr(double_result, 1408 __ vstr(double_result,
1410 FieldMemOperand(heapnumber, HeapNumber::kValueOffset)); 1409 FieldMemOperand(heapnumber, HeapNumber::kValueOffset));
1411 ASSERT(heapnumber.is(r0)); 1410 ASSERT(heapnumber.is(r0));
1412 __ IncrementCounter(counters->math_pow(), 1, scratch, scratch2); 1411 __ IncrementCounter(counters->math_pow(), 1, scratch, scratch2);
(...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after
2051 __ b(ne, &runtime); 2050 __ b(ne, &runtime);
2052 2051
2053 // Patch the arguments.length and the parameters pointer in the current frame. 2052 // Patch the arguments.length and the parameters pointer in the current frame.
2054 __ ldr(r2, MemOperand(r3, ArgumentsAdaptorFrameConstants::kLengthOffset)); 2053 __ ldr(r2, MemOperand(r3, ArgumentsAdaptorFrameConstants::kLengthOffset));
2055 __ str(r2, MemOperand(sp, 0 * kPointerSize)); 2054 __ str(r2, MemOperand(sp, 0 * kPointerSize));
2056 __ add(r3, r3, Operand(r2, LSL, 1)); 2055 __ add(r3, r3, Operand(r2, LSL, 1));
2057 __ add(r3, r3, Operand(StandardFrameConstants::kCallerSPOffset)); 2056 __ add(r3, r3, Operand(StandardFrameConstants::kCallerSPOffset));
2058 __ str(r3, MemOperand(sp, 1 * kPointerSize)); 2057 __ str(r3, MemOperand(sp, 1 * kPointerSize));
2059 2058
2060 __ bind(&runtime); 2059 __ bind(&runtime);
2061 __ TailCallRuntime(Runtime::kHiddenNewSloppyArguments, 3, 1); 2060 __ TailCallRuntime(Runtime::kNewSloppyArguments, 3, 1);
2062 } 2061 }
2063 2062
2064 2063
2065 void ArgumentsAccessStub::GenerateNewSloppyFast(MacroAssembler* masm) { 2064 void ArgumentsAccessStub::GenerateNewSloppyFast(MacroAssembler* masm) {
2066 // Stack layout: 2065 // Stack layout:
2067 // sp[0] : number of parameters (tagged) 2066 // sp[0] : number of parameters (tagged)
2068 // sp[4] : address of receiver argument 2067 // sp[4] : address of receiver argument
2069 // sp[8] : function 2068 // sp[8] : function
2070 // Registers used over whole function: 2069 // Registers used over whole function:
2071 // r6 : allocated object (tagged) 2070 // r6 : allocated object (tagged)
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
2255 2254
2256 // Return and remove the on-stack parameters. 2255 // Return and remove the on-stack parameters.
2257 __ add(sp, sp, Operand(3 * kPointerSize)); 2256 __ add(sp, sp, Operand(3 * kPointerSize));
2258 __ Ret(); 2257 __ Ret();
2259 2258
2260 // Do the runtime call to allocate the arguments object. 2259 // Do the runtime call to allocate the arguments object.
2261 // r0 = address of new object (tagged) 2260 // r0 = address of new object (tagged)
2262 // r2 = argument count (tagged) 2261 // r2 = argument count (tagged)
2263 __ bind(&runtime); 2262 __ bind(&runtime);
2264 __ str(r2, MemOperand(sp, 0 * kPointerSize)); // Patch argument count. 2263 __ str(r2, MemOperand(sp, 0 * kPointerSize)); // Patch argument count.
2265 __ TailCallRuntime(Runtime::kHiddenNewSloppyArguments, 3, 1); 2264 __ TailCallRuntime(Runtime::kNewSloppyArguments, 3, 1);
2266 } 2265 }
2267 2266
2268 2267
2269 void ArgumentsAccessStub::GenerateNewStrict(MacroAssembler* masm) { 2268 void ArgumentsAccessStub::GenerateNewStrict(MacroAssembler* masm) {
2270 // sp[0] : number of parameters 2269 // sp[0] : number of parameters
2271 // sp[4] : receiver displacement 2270 // sp[4] : receiver displacement
2272 // sp[8] : function 2271 // sp[8] : function
2273 // Check if the calling frame is an arguments adaptor frame. 2272 // Check if the calling frame is an arguments adaptor frame.
2274 Label adaptor_frame, try_allocate, runtime; 2273 Label adaptor_frame, try_allocate, runtime;
2275 __ ldr(r2, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); 2274 __ ldr(r2, MemOperand(fp, StandardFrameConstants::kCallerFPOffset));
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
2349 __ cmp(r1, Operand::Zero()); 2348 __ cmp(r1, Operand::Zero());
2350 __ b(ne, &loop); 2349 __ b(ne, &loop);
2351 2350
2352 // Return and remove the on-stack parameters. 2351 // Return and remove the on-stack parameters.
2353 __ bind(&done); 2352 __ bind(&done);
2354 __ add(sp, sp, Operand(3 * kPointerSize)); 2353 __ add(sp, sp, Operand(3 * kPointerSize));
2355 __ Ret(); 2354 __ Ret();
2356 2355
2357 // Do the runtime call to allocate the arguments object. 2356 // Do the runtime call to allocate the arguments object.
2358 __ bind(&runtime); 2357 __ bind(&runtime);
2359 __ TailCallRuntime(Runtime::kHiddenNewStrictArguments, 3, 1); 2358 __ TailCallRuntime(Runtime::kNewStrictArguments, 3, 1);
2360 } 2359 }
2361 2360
2362 2361
2363 void RegExpExecStub::Generate(MacroAssembler* masm) { 2362 void RegExpExecStub::Generate(MacroAssembler* masm) {
2364 // Just jump directly to runtime if native RegExp is not selected at compile 2363 // Just jump directly to runtime if native RegExp is not selected at compile
2365 // time or if regexp entry in generated code is turned off runtime switch or 2364 // time or if regexp entry in generated code is turned off runtime switch or
2366 // at compilation. 2365 // at compilation.
2367 #ifdef V8_INTERPRETED_REGEXP 2366 #ifdef V8_INTERPRETED_REGEXP
2368 __ TailCallRuntime(Runtime::kHiddenRegExpExec, 4, 1); 2367 __ TailCallRuntime(Runtime::kRegExpExec, 4, 1);
2369 #else // V8_INTERPRETED_REGEXP 2368 #else // V8_INTERPRETED_REGEXP
2370 2369
2371 // Stack frame on entry. 2370 // Stack frame on entry.
2372 // sp[0]: last_match_info (expected JSArray) 2371 // sp[0]: last_match_info (expected JSArray)
2373 // sp[4]: previous index 2372 // sp[4]: previous index
2374 // sp[8]: subject string 2373 // sp[8]: subject string
2375 // sp[12]: JSRegExp object 2374 // sp[12]: JSRegExp object
2376 2375
2377 const int kLastMatchInfoOffset = 0 * kPointerSize; 2376 const int kLastMatchInfoOffset = 0 * kPointerSize;
2378 const int kPreviousIndexOffset = 1 * kPointerSize; 2377 const int kPreviousIndexOffset = 1 * kPointerSize;
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
2733 __ jmp(&next_capture); 2732 __ jmp(&next_capture);
2734 __ bind(&done); 2733 __ bind(&done);
2735 2734
2736 // Return last match info. 2735 // Return last match info.
2737 __ ldr(r0, MemOperand(sp, kLastMatchInfoOffset)); 2736 __ ldr(r0, MemOperand(sp, kLastMatchInfoOffset));
2738 __ add(sp, sp, Operand(4 * kPointerSize)); 2737 __ add(sp, sp, Operand(4 * kPointerSize));
2739 __ Ret(); 2738 __ Ret();
2740 2739
2741 // Do the runtime call to execute the regexp. 2740 // Do the runtime call to execute the regexp.
2742 __ bind(&runtime); 2741 __ bind(&runtime);
2743 __ TailCallRuntime(Runtime::kHiddenRegExpExec, 4, 1); 2742 __ TailCallRuntime(Runtime::kRegExpExecRT, 4, 1);
2744 2743
2745 // Deferred code for string handling. 2744 // Deferred code for string handling.
2746 // (6) Not a long external string? If yes, go to (8). 2745 // (6) Not a long external string? If yes, go to (8).
2747 __ bind(&not_seq_nor_cons); 2746 __ bind(&not_seq_nor_cons);
2748 // Compare flags are still set. 2747 // Compare flags are still set.
2749 __ b(gt, &not_long_external); // Go to (8). 2748 __ b(gt, &not_long_external); // Go to (8).
2750 2749
2751 // (7) External string. Make it, offset-wise, look like a sequential string. 2750 // (7) External string. Make it, offset-wise, look like a sequential string.
2752 __ bind(&external_string); 2751 __ bind(&external_string);
2753 __ ldr(r0, FieldMemOperand(subject, HeapObject::kMapOffset)); 2752 __ ldr(r0, FieldMemOperand(subject, HeapObject::kMapOffset));
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after
3248 index_not_number_, 3247 index_not_number_,
3249 DONT_DO_SMI_CHECK); 3248 DONT_DO_SMI_CHECK);
3250 call_helper.BeforeCall(masm); 3249 call_helper.BeforeCall(masm);
3251 __ push(object_); 3250 __ push(object_);
3252 __ push(index_); // Consumed by runtime conversion function. 3251 __ push(index_); // Consumed by runtime conversion function.
3253 if (index_flags_ == STRING_INDEX_IS_NUMBER) { 3252 if (index_flags_ == STRING_INDEX_IS_NUMBER) {
3254 __ CallRuntime(Runtime::kNumberToIntegerMapMinusZero, 1); 3253 __ CallRuntime(Runtime::kNumberToIntegerMapMinusZero, 1);
3255 } else { 3254 } else {
3256 ASSERT(index_flags_ == STRING_INDEX_IS_ARRAY_INDEX); 3255 ASSERT(index_flags_ == STRING_INDEX_IS_ARRAY_INDEX);
3257 // NumberToSmi discards numbers that are not exact integers. 3256 // NumberToSmi discards numbers that are not exact integers.
3258 __ CallRuntime(Runtime::kHiddenNumberToSmi, 1); 3257 __ CallRuntime(Runtime::kNumberToSmi, 1);
3259 } 3258 }
3260 // Save the conversion result before the pop instructions below 3259 // Save the conversion result before the pop instructions below
3261 // have a chance to overwrite it. 3260 // have a chance to overwrite it.
3262 __ Move(index_, r0); 3261 __ Move(index_, r0);
3263 __ pop(object_); 3262 __ pop(object_);
3264 // Reload the instance type. 3263 // Reload the instance type.
3265 __ ldr(result_, FieldMemOperand(object_, HeapObject::kMapOffset)); 3264 __ ldr(result_, FieldMemOperand(object_, HeapObject::kMapOffset));
3266 __ ldrb(result_, FieldMemOperand(result_, Map::kInstanceTypeOffset)); 3265 __ ldrb(result_, FieldMemOperand(result_, Map::kInstanceTypeOffset));
3267 call_helper.AfterCall(masm); 3266 call_helper.AfterCall(masm);
3268 // If index is still not a smi, it must be out of range. 3267 // If index is still not a smi, it must be out of range.
3269 __ JumpIfNotSmi(index_, index_out_of_range_); 3268 __ JumpIfNotSmi(index_, index_out_of_range_);
3270 // Otherwise, return to the fast path. 3269 // Otherwise, return to the fast path.
3271 __ jmp(&got_smi_index_); 3270 __ jmp(&got_smi_index_);
3272 3271
3273 // Call runtime. We get here when the receiver is a string and the 3272 // Call runtime. We get here when the receiver is a string and the
3274 // index is a number, but the code of getting the actual character 3273 // index is a number, but the code of getting the actual character
3275 // is too complex (e.g., when the string needs to be flattened). 3274 // is too complex (e.g., when the string needs to be flattened).
3276 __ bind(&call_runtime_); 3275 __ bind(&call_runtime_);
3277 call_helper.BeforeCall(masm); 3276 call_helper.BeforeCall(masm);
3278 __ SmiTag(index_); 3277 __ SmiTag(index_);
3279 __ Push(object_, index_); 3278 __ Push(object_, index_);
3280 __ CallRuntime(Runtime::kHiddenStringCharCodeAt, 2); 3279 __ CallRuntime(Runtime::kStringCharCodeAtRT, 2);
3281 __ Move(result_, r0); 3280 __ Move(result_, r0);
3282 call_helper.AfterCall(masm); 3281 call_helper.AfterCall(masm);
3283 __ jmp(&exit_); 3282 __ jmp(&exit_);
3284 3283
3285 __ Abort(kUnexpectedFallthroughFromCharCodeAtSlowCase); 3284 __ Abort(kUnexpectedFallthroughFromCharCodeAtSlowCase);
3286 } 3285 }
3287 3286
3288 3287
3289 // ------------------------------------------------------------------------- 3288 // -------------------------------------------------------------------------
3290 // StringCharFromCodeGenerator 3289 // StringCharFromCodeGenerator
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
3611 masm, r1, r5, r2, r3, String::TWO_BYTE_ENCODING); 3610 masm, r1, r5, r2, r3, String::TWO_BYTE_ENCODING);
3612 3611
3613 __ bind(&return_r0); 3612 __ bind(&return_r0);
3614 Counters* counters = isolate()->counters(); 3613 Counters* counters = isolate()->counters();
3615 __ IncrementCounter(counters->sub_string_native(), 1, r3, r4); 3614 __ IncrementCounter(counters->sub_string_native(), 1, r3, r4);
3616 __ Drop(3); 3615 __ Drop(3);
3617 __ Ret(); 3616 __ Ret();
3618 3617
3619 // Just jump to runtime to create the sub string. 3618 // Just jump to runtime to create the sub string.
3620 __ bind(&runtime); 3619 __ bind(&runtime);
3621 __ TailCallRuntime(Runtime::kHiddenSubString, 3, 1); 3620 __ TailCallRuntime(Runtime::kSubString, 3, 1);
3622 3621
3623 __ bind(&single_char); 3622 __ bind(&single_char);
3624 // r0: original string 3623 // r0: original string
3625 // r1: instance type 3624 // r1: instance type
3626 // r2: length 3625 // r2: length
3627 // r3: from index (untagged) 3626 // r3: from index (untagged)
3628 __ SmiTag(r3, r3); 3627 __ SmiTag(r3, r3);
3629 StringCharAtGenerator generator( 3628 StringCharAtGenerator generator(
3630 r0, r3, r2, r0, &runtime, &runtime, &runtime, STRING_INDEX_IS_NUMBER); 3629 r0, r3, r2, r0, &runtime, &runtime, &runtime, STRING_INDEX_IS_NUMBER);
3631 generator.GenerateFast(masm); 3630 generator.GenerateFast(masm);
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
3769 __ JumpIfNotBothSequentialAsciiStrings(r1, r0, r2, r3, &runtime); 3768 __ JumpIfNotBothSequentialAsciiStrings(r1, r0, r2, r3, &runtime);
3770 3769
3771 // Compare flat ASCII strings natively. Remove arguments from stack first. 3770 // Compare flat ASCII strings natively. Remove arguments from stack first.
3772 __ IncrementCounter(counters->string_compare_native(), 1, r2, r3); 3771 __ IncrementCounter(counters->string_compare_native(), 1, r2, r3);
3773 __ add(sp, sp, Operand(2 * kPointerSize)); 3772 __ add(sp, sp, Operand(2 * kPointerSize));
3774 GenerateCompareFlatAsciiStrings(masm, r1, r0, r2, r3, r4, r5); 3773 GenerateCompareFlatAsciiStrings(masm, r1, r0, r2, r3, r4, r5);
3775 3774
3776 // Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater) 3775 // Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater)
3777 // tagged as a small integer. 3776 // tagged as a small integer.
3778 __ bind(&runtime); 3777 __ bind(&runtime);
3779 __ TailCallRuntime(Runtime::kHiddenStringCompare, 2, 1); 3778 __ TailCallRuntime(Runtime::kStringCompare, 2, 1);
3780 } 3779 }
3781 3780
3782 3781
3783 void BinaryOpICWithAllocationSiteStub::Generate(MacroAssembler* masm) { 3782 void BinaryOpICWithAllocationSiteStub::Generate(MacroAssembler* masm) {
3784 // ----------- S t a t e ------------- 3783 // ----------- S t a t e -------------
3785 // -- r1 : left 3784 // -- r1 : left
3786 // -- r0 : right 3785 // -- r0 : right
3787 // -- lr : return address 3786 // -- lr : return address
3788 // ----------------------------------- 3787 // -----------------------------------
3789 3788
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
4050 StringCompareStub::GenerateCompareFlatAsciiStrings( 4049 StringCompareStub::GenerateCompareFlatAsciiStrings(
4051 masm, left, right, tmp1, tmp2, tmp3, tmp4); 4050 masm, left, right, tmp1, tmp2, tmp3, tmp4);
4052 } 4051 }
4053 4052
4054 // Handle more complex cases in runtime. 4053 // Handle more complex cases in runtime.
4055 __ bind(&runtime); 4054 __ bind(&runtime);
4056 __ Push(left, right); 4055 __ Push(left, right);
4057 if (equality) { 4056 if (equality) {
4058 __ TailCallRuntime(Runtime::kStringEquals, 2, 1); 4057 __ TailCallRuntime(Runtime::kStringEquals, 2, 1);
4059 } else { 4058 } else {
4060 __ TailCallRuntime(Runtime::kHiddenStringCompare, 2, 1); 4059 __ TailCallRuntime(Runtime::kStringCompare, 2, 1);
4061 } 4060 }
4062 4061
4063 __ bind(&miss); 4062 __ bind(&miss);
4064 GenerateMiss(masm); 4063 GenerateMiss(masm);
4065 } 4064 }
4066 4065
4067 4066
4068 void ICCompareStub::GenerateObjects(MacroAssembler* masm) { 4067 void ICCompareStub::GenerateObjects(MacroAssembler* masm) {
4069 ASSERT(state_ == CompareIC::OBJECT); 4068 ASSERT(state_ == CompareIC::OBJECT);
4070 Label miss; 4069 Label miss;
(...skipping 1108 matching lines...) Expand 10 before | Expand all | Expand 10 after
5179 MemOperand(fp, 6 * kPointerSize), 5178 MemOperand(fp, 6 * kPointerSize),
5180 NULL); 5179 NULL);
5181 } 5180 }
5182 5181
5183 5182
5184 #undef __ 5183 #undef __
5185 5184
5186 } } // namespace v8::internal 5185 } } // namespace v8::internal
5187 5186
5188 #endif // V8_TARGET_ARCH_ARM 5187 #endif // V8_TARGET_ARCH_ARM
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698