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