OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 21 matching lines...) Expand all Loading... |
32 #include "bootstrapper.h" | 32 #include "bootstrapper.h" |
33 #include "code-stubs.h" | 33 #include "code-stubs.h" |
34 #include "codegen.h" | 34 #include "codegen.h" |
35 #include "regexp-macro-assembler.h" | 35 #include "regexp-macro-assembler.h" |
36 #include "stub-cache.h" | 36 #include "stub-cache.h" |
37 | 37 |
38 namespace v8 { | 38 namespace v8 { |
39 namespace internal { | 39 namespace internal { |
40 | 40 |
41 | 41 |
| 42 void ToNumberStub::InitializeInterfaceDescriptor( |
| 43 Isolate* isolate, |
| 44 CodeStubInterfaceDescriptor* descriptor) { |
| 45 static Register registers[] = { a0 }; |
| 46 descriptor->register_param_count_ = 1; |
| 47 descriptor->register_params_ = registers; |
| 48 descriptor->deoptimization_handler_ = NULL; |
| 49 } |
| 50 |
| 51 |
42 void FastCloneShallowArrayStub::InitializeInterfaceDescriptor( | 52 void FastCloneShallowArrayStub::InitializeInterfaceDescriptor( |
43 Isolate* isolate, | 53 Isolate* isolate, |
44 CodeStubInterfaceDescriptor* descriptor) { | 54 CodeStubInterfaceDescriptor* descriptor) { |
45 static Register registers[] = { a3, a2, a1 }; | 55 static Register registers[] = { a3, a2, a1 }; |
46 descriptor->register_param_count_ = 3; | 56 descriptor->register_param_count_ = 3; |
47 descriptor->register_params_ = registers; | 57 descriptor->register_params_ = registers; |
48 descriptor->deoptimization_handler_ = | 58 descriptor->deoptimization_handler_ = |
49 Runtime::FunctionForId(Runtime::kCreateArrayLiteralShallow)->entry; | 59 Runtime::FunctionForId(Runtime::kCreateArrayLiteralShallow)->entry; |
50 } | 60 } |
51 | 61 |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 Register lhs, | 290 Register lhs, |
281 Register rhs, | 291 Register rhs, |
282 Label* rhs_not_nan, | 292 Label* rhs_not_nan, |
283 Label* slow, | 293 Label* slow, |
284 bool strict); | 294 bool strict); |
285 static void EmitStrictTwoHeapObjectCompare(MacroAssembler* masm, | 295 static void EmitStrictTwoHeapObjectCompare(MacroAssembler* masm, |
286 Register lhs, | 296 Register lhs, |
287 Register rhs); | 297 Register rhs); |
288 | 298 |
289 | 299 |
290 // Check if the operand is a heap number. | |
291 static void EmitCheckForHeapNumber(MacroAssembler* masm, Register operand, | |
292 Register scratch1, Register scratch2, | |
293 Label* not_a_heap_number) { | |
294 __ lw(scratch1, FieldMemOperand(operand, HeapObject::kMapOffset)); | |
295 __ LoadRoot(scratch2, Heap::kHeapNumberMapRootIndex); | |
296 __ Branch(not_a_heap_number, ne, scratch1, Operand(scratch2)); | |
297 } | |
298 | |
299 | |
300 void HydrogenCodeStub::GenerateLightweightMiss(MacroAssembler* masm) { | 300 void HydrogenCodeStub::GenerateLightweightMiss(MacroAssembler* masm) { |
301 // Update the static counter each time a new code stub is generated. | 301 // Update the static counter each time a new code stub is generated. |
302 Isolate* isolate = masm->isolate(); | 302 Isolate* isolate = masm->isolate(); |
303 isolate->counters()->code_stubs()->Increment(); | 303 isolate->counters()->code_stubs()->Increment(); |
304 | 304 |
305 CodeStubInterfaceDescriptor* descriptor = GetInterfaceDescriptor(isolate); | 305 CodeStubInterfaceDescriptor* descriptor = GetInterfaceDescriptor(isolate); |
306 int param_count = descriptor->register_param_count_; | 306 int param_count = descriptor->register_param_count_; |
307 { | 307 { |
308 // Call the runtime system in a fresh internal frame. | 308 // Call the runtime system in a fresh internal frame. |
309 FrameScope scope(masm, StackFrame::INTERNAL); | 309 FrameScope scope(masm, StackFrame::INTERNAL); |
310 ASSERT(descriptor->register_param_count_ == 0 || | 310 ASSERT(descriptor->register_param_count_ == 0 || |
311 a0.is(descriptor->register_params_[param_count - 1])); | 311 a0.is(descriptor->register_params_[param_count - 1])); |
312 // Push arguments | 312 // Push arguments |
313 for (int i = 0; i < param_count; ++i) { | 313 for (int i = 0; i < param_count; ++i) { |
314 __ push(descriptor->register_params_[i]); | 314 __ push(descriptor->register_params_[i]); |
315 } | 315 } |
316 ExternalReference miss = descriptor->miss_handler(); | 316 ExternalReference miss = descriptor->miss_handler(); |
317 __ CallExternalReference(miss, descriptor->register_param_count_); | 317 __ CallExternalReference(miss, descriptor->register_param_count_); |
318 } | 318 } |
319 | 319 |
320 __ Ret(); | 320 __ Ret(); |
321 } | 321 } |
322 | 322 |
323 | 323 |
324 void ToNumberStub::Generate(MacroAssembler* masm) { | |
325 // The ToNumber stub takes one argument in a0. | |
326 Label check_heap_number, call_builtin; | |
327 __ JumpIfNotSmi(a0, &check_heap_number); | |
328 __ Ret(USE_DELAY_SLOT); | |
329 __ mov(v0, a0); | |
330 | |
331 __ bind(&check_heap_number); | |
332 EmitCheckForHeapNumber(masm, a0, a1, t0, &call_builtin); | |
333 __ Ret(USE_DELAY_SLOT); | |
334 __ mov(v0, a0); | |
335 | |
336 __ bind(&call_builtin); | |
337 __ push(a0); | |
338 __ InvokeBuiltin(Builtins::TO_NUMBER, JUMP_FUNCTION); | |
339 } | |
340 | |
341 | |
342 void FastNewClosureStub::Generate(MacroAssembler* masm) { | 324 void FastNewClosureStub::Generate(MacroAssembler* masm) { |
343 // Create a new closure from the given function info in new | 325 // Create a new closure from the given function info in new |
344 // space. Set the context to the current context in cp. | 326 // space. Set the context to the current context in cp. |
345 Counters* counters = masm->isolate()->counters(); | 327 Counters* counters = masm->isolate()->counters(); |
346 | 328 |
347 Label gc; | 329 Label gc; |
348 | 330 |
349 // Pop the function info from the stack. | 331 // Pop the function info from the stack. |
350 __ pop(a3); | 332 __ pop(a3); |
351 | 333 |
(...skipping 7268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7620 __ bind(&fast_elements_case); | 7602 __ bind(&fast_elements_case); |
7621 GenerateCase(masm, FAST_ELEMENTS); | 7603 GenerateCase(masm, FAST_ELEMENTS); |
7622 } | 7604 } |
7623 | 7605 |
7624 | 7606 |
7625 #undef __ | 7607 #undef __ |
7626 | 7608 |
7627 } } // namespace v8::internal | 7609 } } // namespace v8::internal |
7628 | 7610 |
7629 #endif // V8_TARGET_ARCH_MIPS | 7611 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |