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

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

Issue 346413004: Remove distinction between hidden and normal runtime functions (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: 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_MIPS 7 #if V8_TARGET_ARCH_MIPS
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/codegen.h" 11 #include "src/codegen.h"
12 #include "src/regexp-macro-assembler.h" 12 #include "src/regexp-macro-assembler.h"
13 #include "src/stub-cache.h" 13 #include "src/stub-cache.h"
14 14
15 namespace v8 { 15 namespace v8 {
16 namespace internal { 16 namespace internal {
17 17
18 18
19 void FastNewClosureStub::InitializeInterfaceDescriptor( 19 void FastNewClosureStub::InitializeInterfaceDescriptor(
20 CodeStubInterfaceDescriptor* descriptor) { 20 CodeStubInterfaceDescriptor* descriptor) {
21 static Register registers[] = { a2 }; 21 static Register registers[] = { a2 };
22 descriptor->register_param_count_ = 1; 22 descriptor->register_param_count_ = 1;
23 descriptor->register_params_ = registers; 23 descriptor->register_params_ = registers;
24 descriptor->deoptimization_handler_ = 24 descriptor->deoptimization_handler_ =
25 Runtime::FunctionForId(Runtime::kHiddenNewClosureFromStubFailure)->entry; 25 Runtime::FunctionForId(Runtime::kNewClosureFromStubFailure)->entry;
26 } 26 }
27 27
28 28
29 void FastNewContextStub::InitializeInterfaceDescriptor( 29 void FastNewContextStub::InitializeInterfaceDescriptor(
30 CodeStubInterfaceDescriptor* descriptor) { 30 CodeStubInterfaceDescriptor* descriptor) {
31 static Register registers[] = { a1 }; 31 static Register registers[] = { a1 };
32 descriptor->register_param_count_ = 1; 32 descriptor->register_param_count_ = 1;
33 descriptor->register_params_ = registers; 33 descriptor->register_params_ = registers;
34 descriptor->deoptimization_handler_ = NULL; 34 descriptor->deoptimization_handler_ = NULL;
35 } 35 }
36 36
37 37
38 void ToNumberStub::InitializeInterfaceDescriptor( 38 void ToNumberStub::InitializeInterfaceDescriptor(
39 CodeStubInterfaceDescriptor* descriptor) { 39 CodeStubInterfaceDescriptor* descriptor) {
40 static Register registers[] = { a0 }; 40 static Register registers[] = { a0 };
41 descriptor->register_param_count_ = 1; 41 descriptor->register_param_count_ = 1;
42 descriptor->register_params_ = registers; 42 descriptor->register_params_ = registers;
43 descriptor->deoptimization_handler_ = NULL; 43 descriptor->deoptimization_handler_ = NULL;
44 } 44 }
45 45
46 46
47 void NumberToStringStub::InitializeInterfaceDescriptor( 47 void NumberToStringStub::InitializeInterfaceDescriptor(
48 CodeStubInterfaceDescriptor* descriptor) { 48 CodeStubInterfaceDescriptor* descriptor) {
49 static Register registers[] = { a0 }; 49 static Register registers[] = { a0 };
50 descriptor->register_param_count_ = 1; 50 descriptor->register_param_count_ = 1;
51 descriptor->register_params_ = registers; 51 descriptor->register_params_ = registers;
52 descriptor->deoptimization_handler_ = 52 descriptor->deoptimization_handler_ =
53 Runtime::FunctionForId(Runtime::kHiddenNumberToString)->entry; 53 Runtime::FunctionForId(Runtime::kNumberToString)->entry;
54 } 54 }
55 55
56 56
57 void FastCloneShallowArrayStub::InitializeInterfaceDescriptor( 57 void FastCloneShallowArrayStub::InitializeInterfaceDescriptor(
58 CodeStubInterfaceDescriptor* descriptor) { 58 CodeStubInterfaceDescriptor* descriptor) {
59 static Register registers[] = { a3, a2, a1 }; 59 static Register registers[] = { a3, a2, a1 };
60 descriptor->register_param_count_ = 3; 60 descriptor->register_param_count_ = 3;
61 descriptor->register_params_ = registers; 61 descriptor->register_params_ = registers;
62 static Representation representations[] = { 62 static Representation representations[] = {
63 Representation::Tagged(), 63 Representation::Tagged(),
64 Representation::Smi(), 64 Representation::Smi(),
65 Representation::Tagged() }; 65 Representation::Tagged() };
66 descriptor->register_param_representations_ = representations; 66 descriptor->register_param_representations_ = representations;
67 descriptor->deoptimization_handler_ = 67 descriptor->deoptimization_handler_ =
68 Runtime::FunctionForId( 68 Runtime::FunctionForId(
69 Runtime::kHiddenCreateArrayLiteralStubBailout)->entry; 69 Runtime::kCreateArrayLiteralStubBailout)->entry;
70 } 70 }
71 71
72 72
73 void FastCloneShallowObjectStub::InitializeInterfaceDescriptor( 73 void FastCloneShallowObjectStub::InitializeInterfaceDescriptor(
74 CodeStubInterfaceDescriptor* descriptor) { 74 CodeStubInterfaceDescriptor* descriptor) {
75 static Register registers[] = { a3, a2, a1, a0 }; 75 static Register registers[] = { a3, a2, a1, a0 };
76 descriptor->register_param_count_ = 4; 76 descriptor->register_param_count_ = 4;
77 descriptor->register_params_ = registers; 77 descriptor->register_params_ = registers;
78 descriptor->deoptimization_handler_ = 78 descriptor->deoptimization_handler_ =
79 Runtime::FunctionForId(Runtime::kHiddenCreateObjectLiteral)->entry; 79 Runtime::FunctionForId(Runtime::kCreateObjectLiteral)->entry;
80 } 80 }
81 81
82 82
83 void CreateAllocationSiteStub::InitializeInterfaceDescriptor( 83 void CreateAllocationSiteStub::InitializeInterfaceDescriptor(
84 CodeStubInterfaceDescriptor* descriptor) { 84 CodeStubInterfaceDescriptor* descriptor) {
85 static Register registers[] = { a2, a3 }; 85 static Register registers[] = { a2, a3 };
86 descriptor->register_param_count_ = 2; 86 descriptor->register_param_count_ = 2;
87 descriptor->register_params_ = registers; 87 descriptor->register_params_ = registers;
88 descriptor->deoptimization_handler_ = NULL; 88 descriptor->deoptimization_handler_ = NULL;
89 } 89 }
(...skipping 18 matching lines...) Expand all
108 FUNCTION_ADDR(KeyedLoadIC_MissFromStubFailure); 108 FUNCTION_ADDR(KeyedLoadIC_MissFromStubFailure);
109 } 109 }
110 110
111 111
112 void RegExpConstructResultStub::InitializeInterfaceDescriptor( 112 void RegExpConstructResultStub::InitializeInterfaceDescriptor(
113 CodeStubInterfaceDescriptor* descriptor) { 113 CodeStubInterfaceDescriptor* descriptor) {
114 static Register registers[] = { a2, a1, a0 }; 114 static Register registers[] = { a2, a1, a0 };
115 descriptor->register_param_count_ = 3; 115 descriptor->register_param_count_ = 3;
116 descriptor->register_params_ = registers; 116 descriptor->register_params_ = registers;
117 descriptor->deoptimization_handler_ = 117 descriptor->deoptimization_handler_ =
118 Runtime::FunctionForId(Runtime::kHiddenRegExpConstructResult)->entry; 118 Runtime::FunctionForId(Runtime::kRegExpConstructResult)->entry;
119 } 119 }
120 120
121 121
122 void KeyedLoadGenericElementStub::InitializeInterfaceDescriptor( 122 void KeyedLoadGenericElementStub::InitializeInterfaceDescriptor(
123 CodeStubInterfaceDescriptor* descriptor) { 123 CodeStubInterfaceDescriptor* descriptor) {
124 static Register registers[] = { a1, a0 }; 124 static Register registers[] = { a1, a0 };
125 descriptor->register_param_count_ = 2; 125 descriptor->register_param_count_ = 2;
126 descriptor->register_params_ = registers; 126 descriptor->register_params_ = registers;
127 descriptor->deoptimization_handler_ = 127 descriptor->deoptimization_handler_ =
128 Runtime::FunctionForId(Runtime::kKeyedGetProperty)->entry; 128 Runtime::FunctionForId(Runtime::kKeyedGetProperty)->entry;
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 static Representation representations[] = { 220 static Representation representations[] = {
221 Representation::Tagged(), 221 Representation::Tagged(),
222 Representation::Tagged(), 222 Representation::Tagged(),
223 Representation::Integer32() }; 223 Representation::Integer32() };
224 descriptor->register_param_representations_ = representations; 224 descriptor->register_param_representations_ = representations;
225 } 225 }
226 226
227 descriptor->hint_stack_parameter_count_ = constant_stack_parameter_count; 227 descriptor->hint_stack_parameter_count_ = constant_stack_parameter_count;
228 descriptor->function_mode_ = JS_FUNCTION_STUB_MODE; 228 descriptor->function_mode_ = JS_FUNCTION_STUB_MODE;
229 descriptor->deoptimization_handler_ = 229 descriptor->deoptimization_handler_ =
230 Runtime::FunctionForId(Runtime::kHiddenArrayConstructor)->entry; 230 Runtime::FunctionForId(Runtime::kArrayConstructor)->entry;
231 } 231 }
232 232
233 233
234 static void InitializeInternalArrayConstructorDescriptor( 234 static void InitializeInternalArrayConstructorDescriptor(
235 CodeStubInterfaceDescriptor* descriptor, 235 CodeStubInterfaceDescriptor* descriptor,
236 int constant_stack_parameter_count) { 236 int constant_stack_parameter_count) {
237 // register state 237 // register state
238 // a0 -- number of arguments 238 // a0 -- number of arguments
239 // a1 -- constructor function 239 // a1 -- constructor function
240 static Register registers_variable_args[] = { a1, a0 }; 240 static Register registers_variable_args[] = { a1, a0 };
(...skipping 10 matching lines...) Expand all
251 descriptor->register_params_ = registers_variable_args; 251 descriptor->register_params_ = registers_variable_args;
252 static Representation representations[] = { 252 static Representation representations[] = {
253 Representation::Tagged(), 253 Representation::Tagged(),
254 Representation::Integer32() }; 254 Representation::Integer32() };
255 descriptor->register_param_representations_ = representations; 255 descriptor->register_param_representations_ = representations;
256 } 256 }
257 257
258 descriptor->hint_stack_parameter_count_ = constant_stack_parameter_count; 258 descriptor->hint_stack_parameter_count_ = constant_stack_parameter_count;
259 descriptor->function_mode_ = JS_FUNCTION_STUB_MODE; 259 descriptor->function_mode_ = JS_FUNCTION_STUB_MODE;
260 descriptor->deoptimization_handler_ = 260 descriptor->deoptimization_handler_ =
261 Runtime::FunctionForId(Runtime::kHiddenInternalArrayConstructor)->entry; 261 Runtime::FunctionForId(Runtime::kInternalArrayConstructor)->entry;
262 } 262 }
263 263
264 264
265 void ArrayNoArgumentConstructorStub::InitializeInterfaceDescriptor( 265 void ArrayNoArgumentConstructorStub::InitializeInterfaceDescriptor(
266 CodeStubInterfaceDescriptor* descriptor) { 266 CodeStubInterfaceDescriptor* descriptor) {
267 InitializeArrayConstructorDescriptor(descriptor, 0); 267 InitializeArrayConstructorDescriptor(descriptor, 0);
268 } 268 }
269 269
270 270
271 void ArraySingleArgumentConstructorStub::InitializeInterfaceDescriptor( 271 void ArraySingleArgumentConstructorStub::InitializeInterfaceDescriptor(
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 FUNCTION_ADDR(BinaryOpIC_MissWithAllocationSite); 350 FUNCTION_ADDR(BinaryOpIC_MissWithAllocationSite);
351 } 351 }
352 352
353 353
354 void StringAddStub::InitializeInterfaceDescriptor( 354 void StringAddStub::InitializeInterfaceDescriptor(
355 CodeStubInterfaceDescriptor* descriptor) { 355 CodeStubInterfaceDescriptor* descriptor) {
356 static Register registers[] = { a1, a0 }; 356 static Register registers[] = { a1, a0 };
357 descriptor->register_param_count_ = 2; 357 descriptor->register_param_count_ = 2;
358 descriptor->register_params_ = registers; 358 descriptor->register_params_ = registers;
359 descriptor->deoptimization_handler_ = 359 descriptor->deoptimization_handler_ =
360 Runtime::FunctionForId(Runtime::kHiddenStringAdd)->entry; 360 Runtime::FunctionForId(Runtime::kStringAdd)->entry;
361 } 361 }
362 362
363 363
364 void CallDescriptors::InitializeForIsolate(Isolate* isolate) { 364 void CallDescriptors::InitializeForIsolate(Isolate* isolate) {
365 { 365 {
366 CallInterfaceDescriptor* descriptor = 366 CallInterfaceDescriptor* descriptor =
367 isolate->call_descriptor(Isolate::ArgumentAdaptorCall); 367 isolate->call_descriptor(Isolate::ArgumentAdaptorCall);
368 static Register registers[] = { a1, // JSFunction 368 static Register registers[] = { a1, // JSFunction
369 cp, // context 369 cp, // context
370 a0, // actual number of arguments 370 a0, // actual number of arguments
(...skipping 1106 matching lines...) Expand 10 before | Expand all | Expand 10 after
1477 // double_exponent may not contain the exponent value if the input was a 1477 // double_exponent may not contain the exponent value if the input was a
1478 // smi. We set it with exponent value before bailing out. 1478 // smi. We set it with exponent value before bailing out.
1479 __ mtc1(exponent, single_scratch); 1479 __ mtc1(exponent, single_scratch);
1480 __ cvt_d_w(double_exponent, single_scratch); 1480 __ cvt_d_w(double_exponent, single_scratch);
1481 1481
1482 // Returning or bailing out. 1482 // Returning or bailing out.
1483 Counters* counters = isolate()->counters(); 1483 Counters* counters = isolate()->counters();
1484 if (exponent_type_ == ON_STACK) { 1484 if (exponent_type_ == ON_STACK) {
1485 // The arguments are still on the stack. 1485 // The arguments are still on the stack.
1486 __ bind(&call_runtime); 1486 __ bind(&call_runtime);
1487 __ TailCallRuntime(Runtime::kHiddenMathPow, 2, 1); 1487 __ TailCallRuntime(Runtime::kMathPow, 2, 1);
1488 1488
1489 // The stub is called from non-optimized code, which expects the result 1489 // The stub is called from non-optimized code, which expects the result
1490 // as heap number in exponent. 1490 // as heap number in exponent.
1491 __ bind(&done); 1491 __ bind(&done);
1492 __ AllocateHeapNumber( 1492 __ AllocateHeapNumber(
1493 heapnumber, scratch, scratch2, heapnumbermap, &call_runtime); 1493 heapnumber, scratch, scratch2, heapnumbermap, &call_runtime);
1494 __ sdc1(double_result, 1494 __ sdc1(double_result,
1495 FieldMemOperand(heapnumber, HeapNumber::kValueOffset)); 1495 FieldMemOperand(heapnumber, HeapNumber::kValueOffset));
1496 ASSERT(heapnumber.is(v0)); 1496 ASSERT(heapnumber.is(v0));
1497 __ IncrementCounter(counters->math_pow(), 1, scratch, scratch2); 1497 __ IncrementCounter(counters->math_pow(), 1, scratch, scratch2);
(...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after
2171 2171
2172 // Patch the arguments.length and the parameters pointer in the current frame. 2172 // Patch the arguments.length and the parameters pointer in the current frame.
2173 __ lw(a2, MemOperand(a3, ArgumentsAdaptorFrameConstants::kLengthOffset)); 2173 __ lw(a2, MemOperand(a3, ArgumentsAdaptorFrameConstants::kLengthOffset));
2174 __ sw(a2, MemOperand(sp, 0 * kPointerSize)); 2174 __ sw(a2, MemOperand(sp, 0 * kPointerSize));
2175 __ sll(t3, a2, 1); 2175 __ sll(t3, a2, 1);
2176 __ Addu(a3, a3, Operand(t3)); 2176 __ Addu(a3, a3, Operand(t3));
2177 __ addiu(a3, a3, StandardFrameConstants::kCallerSPOffset); 2177 __ addiu(a3, a3, StandardFrameConstants::kCallerSPOffset);
2178 __ sw(a3, MemOperand(sp, 1 * kPointerSize)); 2178 __ sw(a3, MemOperand(sp, 1 * kPointerSize));
2179 2179
2180 __ bind(&runtime); 2180 __ bind(&runtime);
2181 __ TailCallRuntime(Runtime::kHiddenNewSloppyArguments, 3, 1); 2181 __ TailCallRuntime(Runtime::kNewSloppyArguments, 3, 1);
2182 } 2182 }
2183 2183
2184 2184
2185 void ArgumentsAccessStub::GenerateNewSloppyFast(MacroAssembler* masm) { 2185 void ArgumentsAccessStub::GenerateNewSloppyFast(MacroAssembler* masm) {
2186 // Stack layout: 2186 // Stack layout:
2187 // sp[0] : number of parameters (tagged) 2187 // sp[0] : number of parameters (tagged)
2188 // sp[4] : address of receiver argument 2188 // sp[4] : address of receiver argument
2189 // sp[8] : function 2189 // sp[8] : function
2190 // Registers used over whole function: 2190 // Registers used over whole function:
2191 // t2 : allocated object (tagged) 2191 // t2 : allocated object (tagged)
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
2390 __ bind(&arguments_test); 2390 __ bind(&arguments_test);
2391 __ Branch(&arguments_loop, lt, t5, Operand(a2)); 2391 __ Branch(&arguments_loop, lt, t5, Operand(a2));
2392 2392
2393 // Return and remove the on-stack parameters. 2393 // Return and remove the on-stack parameters.
2394 __ DropAndRet(3); 2394 __ DropAndRet(3);
2395 2395
2396 // Do the runtime call to allocate the arguments object. 2396 // Do the runtime call to allocate the arguments object.
2397 // a2 = argument count (tagged) 2397 // a2 = argument count (tagged)
2398 __ bind(&runtime); 2398 __ bind(&runtime);
2399 __ sw(a2, MemOperand(sp, 0 * kPointerSize)); // Patch argument count. 2399 __ sw(a2, MemOperand(sp, 0 * kPointerSize)); // Patch argument count.
2400 __ TailCallRuntime(Runtime::kHiddenNewSloppyArguments, 3, 1); 2400 __ TailCallRuntime(Runtime::kNewSloppyArguments, 3, 1);
2401 } 2401 }
2402 2402
2403 2403
2404 void ArgumentsAccessStub::GenerateNewStrict(MacroAssembler* masm) { 2404 void ArgumentsAccessStub::GenerateNewStrict(MacroAssembler* masm) {
2405 // sp[0] : number of parameters 2405 // sp[0] : number of parameters
2406 // sp[4] : receiver displacement 2406 // sp[4] : receiver displacement
2407 // sp[8] : function 2407 // sp[8] : function
2408 // Check if the calling frame is an arguments adaptor frame. 2408 // Check if the calling frame is an arguments adaptor frame.
2409 Label adaptor_frame, try_allocate, runtime; 2409 Label adaptor_frame, try_allocate, runtime;
2410 __ lw(a2, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); 2410 __ lw(a2, MemOperand(fp, StandardFrameConstants::kCallerFPOffset));
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
2488 __ Addu(t0, t0, Operand(kPointerSize)); 2488 __ Addu(t0, t0, Operand(kPointerSize));
2489 __ Subu(a1, a1, Operand(1)); 2489 __ Subu(a1, a1, Operand(1));
2490 __ Branch(&loop, ne, a1, Operand(zero_reg)); 2490 __ Branch(&loop, ne, a1, Operand(zero_reg));
2491 2491
2492 // Return and remove the on-stack parameters. 2492 // Return and remove the on-stack parameters.
2493 __ bind(&done); 2493 __ bind(&done);
2494 __ DropAndRet(3); 2494 __ DropAndRet(3);
2495 2495
2496 // Do the runtime call to allocate the arguments object. 2496 // Do the runtime call to allocate the arguments object.
2497 __ bind(&runtime); 2497 __ bind(&runtime);
2498 __ TailCallRuntime(Runtime::kHiddenNewStrictArguments, 3, 1); 2498 __ TailCallRuntime(Runtime::kNewStrictArguments, 3, 1);
2499 } 2499 }
2500 2500
2501 2501
2502 void RegExpExecStub::Generate(MacroAssembler* masm) { 2502 void RegExpExecStub::Generate(MacroAssembler* masm) {
2503 // Just jump directly to runtime if native RegExp is not selected at compile 2503 // Just jump directly to runtime if native RegExp is not selected at compile
2504 // time or if regexp entry in generated code is turned off runtime switch or 2504 // time or if regexp entry in generated code is turned off runtime switch or
2505 // at compilation. 2505 // at compilation.
2506 #ifdef V8_INTERPRETED_REGEXP 2506 #ifdef V8_INTERPRETED_REGEXP
2507 __ TailCallRuntime(Runtime::kHiddenRegExpExec, 4, 1); 2507 __ TailCallRuntime(Runtime::kRegExpExec, 4, 1);
2508 #else // V8_INTERPRETED_REGEXP 2508 #else // V8_INTERPRETED_REGEXP
2509 2509
2510 // Stack frame on entry. 2510 // Stack frame on entry.
2511 // sp[0]: last_match_info (expected JSArray) 2511 // sp[0]: last_match_info (expected JSArray)
2512 // sp[4]: previous index 2512 // sp[4]: previous index
2513 // sp[8]: subject string 2513 // sp[8]: subject string
2514 // sp[12]: JSRegExp object 2514 // sp[12]: JSRegExp object
2515 2515
2516 const int kLastMatchInfoOffset = 0 * kPointerSize; 2516 const int kLastMatchInfoOffset = 0 * kPointerSize;
2517 const int kPreviousIndexOffset = 1 * kPointerSize; 2517 const int kPreviousIndexOffset = 1 * kPointerSize;
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
2887 __ addiu(a0, a0, kPointerSize); // In branch delay slot. 2887 __ addiu(a0, a0, kPointerSize); // In branch delay slot.
2888 2888
2889 __ bind(&done); 2889 __ bind(&done);
2890 2890
2891 // Return last match info. 2891 // Return last match info.
2892 __ lw(v0, MemOperand(sp, kLastMatchInfoOffset)); 2892 __ lw(v0, MemOperand(sp, kLastMatchInfoOffset));
2893 __ DropAndRet(4); 2893 __ DropAndRet(4);
2894 2894
2895 // Do the runtime call to execute the regexp. 2895 // Do the runtime call to execute the regexp.
2896 __ bind(&runtime); 2896 __ bind(&runtime);
2897 __ TailCallRuntime(Runtime::kHiddenRegExpExec, 4, 1); 2897 __ TailCallRuntime(Runtime::kRegExpExec, 4, 1);
2898 2898
2899 // Deferred code for string handling. 2899 // Deferred code for string handling.
2900 // (6) Not a long external string? If yes, go to (8). 2900 // (6) Not a long external string? If yes, go to (8).
2901 __ bind(&not_seq_nor_cons); 2901 __ bind(&not_seq_nor_cons);
2902 // Go to (8). 2902 // Go to (8).
2903 __ Branch(&not_long_external, gt, a1, Operand(kExternalStringTag)); 2903 __ Branch(&not_long_external, gt, a1, Operand(kExternalStringTag));
2904 2904
2905 // (7) External string. Make it, offset-wise, look like a sequential string. 2905 // (7) External string. Make it, offset-wise, look like a sequential string.
2906 __ bind(&external_string); 2906 __ bind(&external_string);
2907 __ lw(a0, FieldMemOperand(subject, HeapObject::kMapOffset)); 2907 __ lw(a0, FieldMemOperand(subject, HeapObject::kMapOffset));
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after
3412 index_not_number_, 3412 index_not_number_,
3413 DONT_DO_SMI_CHECK); 3413 DONT_DO_SMI_CHECK);
3414 call_helper.BeforeCall(masm); 3414 call_helper.BeforeCall(masm);
3415 // Consumed by runtime conversion function: 3415 // Consumed by runtime conversion function:
3416 __ Push(object_, index_); 3416 __ Push(object_, index_);
3417 if (index_flags_ == STRING_INDEX_IS_NUMBER) { 3417 if (index_flags_ == STRING_INDEX_IS_NUMBER) {
3418 __ CallRuntime(Runtime::kNumberToIntegerMapMinusZero, 1); 3418 __ CallRuntime(Runtime::kNumberToIntegerMapMinusZero, 1);
3419 } else { 3419 } else {
3420 ASSERT(index_flags_ == STRING_INDEX_IS_ARRAY_INDEX); 3420 ASSERT(index_flags_ == STRING_INDEX_IS_ARRAY_INDEX);
3421 // NumberToSmi discards numbers that are not exact integers. 3421 // NumberToSmi discards numbers that are not exact integers.
3422 __ CallRuntime(Runtime::kHiddenNumberToSmi, 1); 3422 __ CallRuntime(Runtime::kNumberToSmi, 1);
3423 } 3423 }
3424 3424
3425 // Save the conversion result before the pop instructions below 3425 // Save the conversion result before the pop instructions below
3426 // have a chance to overwrite it. 3426 // have a chance to overwrite it.
3427 3427
3428 __ Move(index_, v0); 3428 __ Move(index_, v0);
3429 __ pop(object_); 3429 __ pop(object_);
3430 // Reload the instance type. 3430 // Reload the instance type.
3431 __ lw(result_, FieldMemOperand(object_, HeapObject::kMapOffset)); 3431 __ lw(result_, FieldMemOperand(object_, HeapObject::kMapOffset));
3432 __ lbu(result_, FieldMemOperand(result_, Map::kInstanceTypeOffset)); 3432 __ lbu(result_, FieldMemOperand(result_, Map::kInstanceTypeOffset));
3433 call_helper.AfterCall(masm); 3433 call_helper.AfterCall(masm);
3434 // If index is still not a smi, it must be out of range. 3434 // If index is still not a smi, it must be out of range.
3435 __ JumpIfNotSmi(index_, index_out_of_range_); 3435 __ JumpIfNotSmi(index_, index_out_of_range_);
3436 // Otherwise, return to the fast path. 3436 // Otherwise, return to the fast path.
3437 __ Branch(&got_smi_index_); 3437 __ Branch(&got_smi_index_);
3438 3438
3439 // Call runtime. We get here when the receiver is a string and the 3439 // Call runtime. We get here when the receiver is a string and the
3440 // index is a number, but the code of getting the actual character 3440 // index is a number, but the code of getting the actual character
3441 // is too complex (e.g., when the string needs to be flattened). 3441 // is too complex (e.g., when the string needs to be flattened).
3442 __ bind(&call_runtime_); 3442 __ bind(&call_runtime_);
3443 call_helper.BeforeCall(masm); 3443 call_helper.BeforeCall(masm);
3444 __ sll(index_, index_, kSmiTagSize); 3444 __ sll(index_, index_, kSmiTagSize);
3445 __ Push(object_, index_); 3445 __ Push(object_, index_);
3446 __ CallRuntime(Runtime::kHiddenStringCharCodeAt, 2); 3446 __ CallRuntime(Runtime::kStringCharCodeAt, 2);
3447 3447
3448 __ Move(result_, v0); 3448 __ Move(result_, v0);
3449 3449
3450 call_helper.AfterCall(masm); 3450 call_helper.AfterCall(masm);
3451 __ jmp(&exit_); 3451 __ jmp(&exit_);
3452 3452
3453 __ Abort(kUnexpectedFallthroughFromCharCodeAtSlowCase); 3453 __ Abort(kUnexpectedFallthroughFromCharCodeAtSlowCase);
3454 } 3454 }
3455 3455
3456 3456
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
3800 StringHelper::GenerateCopyCharacters( 3800 StringHelper::GenerateCopyCharacters(
3801 masm, a1, t1, a2, a3, String::TWO_BYTE_ENCODING); 3801 masm, a1, t1, a2, a3, String::TWO_BYTE_ENCODING);
3802 3802
3803 __ bind(&return_v0); 3803 __ bind(&return_v0);
3804 Counters* counters = isolate()->counters(); 3804 Counters* counters = isolate()->counters();
3805 __ IncrementCounter(counters->sub_string_native(), 1, a3, t0); 3805 __ IncrementCounter(counters->sub_string_native(), 1, a3, t0);
3806 __ DropAndRet(3); 3806 __ DropAndRet(3);
3807 3807
3808 // Just jump to runtime to create the sub string. 3808 // Just jump to runtime to create the sub string.
3809 __ bind(&runtime); 3809 __ bind(&runtime);
3810 __ TailCallRuntime(Runtime::kHiddenSubString, 3, 1); 3810 __ TailCallRuntime(Runtime::kSubString, 3, 1);
3811 3811
3812 __ bind(&single_char); 3812 __ bind(&single_char);
3813 // v0: original string 3813 // v0: original string
3814 // a1: instance type 3814 // a1: instance type
3815 // a2: length 3815 // a2: length
3816 // a3: from index (untagged) 3816 // a3: from index (untagged)
3817 __ SmiTag(a3, a3); 3817 __ SmiTag(a3, a3);
3818 StringCharAtGenerator generator( 3818 StringCharAtGenerator generator(
3819 v0, a3, a2, v0, &runtime, &runtime, &runtime, STRING_INDEX_IS_NUMBER); 3819 v0, a3, a2, v0, &runtime, &runtime, &runtime, STRING_INDEX_IS_NUMBER);
3820 generator.GenerateFast(masm); 3820 generator.GenerateFast(masm);
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
3965 3965
3966 // Check that both objects are sequential ASCII strings. 3966 // Check that both objects are sequential ASCII strings.
3967 __ JumpIfNotBothSequentialAsciiStrings(a1, a0, a2, a3, &runtime); 3967 __ JumpIfNotBothSequentialAsciiStrings(a1, a0, a2, a3, &runtime);
3968 3968
3969 // Compare flat ASCII strings natively. Remove arguments from stack first. 3969 // Compare flat ASCII strings natively. Remove arguments from stack first.
3970 __ IncrementCounter(counters->string_compare_native(), 1, a2, a3); 3970 __ IncrementCounter(counters->string_compare_native(), 1, a2, a3);
3971 __ Addu(sp, sp, Operand(2 * kPointerSize)); 3971 __ Addu(sp, sp, Operand(2 * kPointerSize));
3972 GenerateCompareFlatAsciiStrings(masm, a1, a0, a2, a3, t0, t1); 3972 GenerateCompareFlatAsciiStrings(masm, a1, a0, a2, a3, t0, t1);
3973 3973
3974 __ bind(&runtime); 3974 __ bind(&runtime);
3975 __ TailCallRuntime(Runtime::kHiddenStringCompare, 2, 1); 3975 __ TailCallRuntime(Runtime::kStringCompare, 2, 1);
3976 } 3976 }
3977 3977
3978 3978
3979 void BinaryOpICWithAllocationSiteStub::Generate(MacroAssembler* masm) { 3979 void BinaryOpICWithAllocationSiteStub::Generate(MacroAssembler* masm) {
3980 // ----------- S t a t e ------------- 3980 // ----------- S t a t e -------------
3981 // -- a1 : left 3981 // -- a1 : left
3982 // -- a0 : right 3982 // -- a0 : right
3983 // -- ra : return address 3983 // -- ra : return address
3984 // ----------------------------------- 3984 // -----------------------------------
3985 3985
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
4275 StringCompareStub::GenerateCompareFlatAsciiStrings( 4275 StringCompareStub::GenerateCompareFlatAsciiStrings(
4276 masm, left, right, tmp1, tmp2, tmp3, tmp4); 4276 masm, left, right, tmp1, tmp2, tmp3, tmp4);
4277 } 4277 }
4278 4278
4279 // Handle more complex cases in runtime. 4279 // Handle more complex cases in runtime.
4280 __ bind(&runtime); 4280 __ bind(&runtime);
4281 __ Push(left, right); 4281 __ Push(left, right);
4282 if (equality) { 4282 if (equality) {
4283 __ TailCallRuntime(Runtime::kStringEquals, 2, 1); 4283 __ TailCallRuntime(Runtime::kStringEquals, 2, 1);
4284 } else { 4284 } else {
4285 __ TailCallRuntime(Runtime::kHiddenStringCompare, 2, 1); 4285 __ TailCallRuntime(Runtime::kStringCompare, 2, 1);
4286 } 4286 }
4287 4287
4288 __ bind(&miss); 4288 __ bind(&miss);
4289 GenerateMiss(masm); 4289 GenerateMiss(masm);
4290 } 4290 }
4291 4291
4292 4292
4293 void ICCompareStub::GenerateObjects(MacroAssembler* masm) { 4293 void ICCompareStub::GenerateObjects(MacroAssembler* masm) {
4294 ASSERT(state_ == CompareIC::OBJECT); 4294 ASSERT(state_ == CompareIC::OBJECT);
4295 Label miss; 4295 Label miss;
(...skipping 1111 matching lines...) Expand 10 before | Expand all | Expand 10 after
5407 MemOperand(fp, 6 * kPointerSize), 5407 MemOperand(fp, 6 * kPointerSize),
5408 NULL); 5408 NULL);
5409 } 5409 }
5410 5410
5411 5411
5412 #undef __ 5412 #undef __
5413 5413
5414 } } // namespace v8::internal 5414 } } // namespace v8::internal
5415 5415
5416 #endif // V8_TARGET_ARCH_MIPS 5416 #endif // V8_TARGET_ARCH_MIPS
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698