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 3360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3371 VisitForStackValue(args->at(2)); | 3371 VisitForStackValue(args->at(2)); |
3372 __ CallRuntime(Runtime::kLog, 2); | 3372 __ CallRuntime(Runtime::kLog, 2); |
3373 } | 3373 } |
3374 | 3374 |
3375 // Finally, we're expected to leave a value on the top of the stack. | 3375 // Finally, we're expected to leave a value on the top of the stack. |
3376 __ LoadRoot(v0, Heap::kUndefinedValueRootIndex); | 3376 __ LoadRoot(v0, Heap::kUndefinedValueRootIndex); |
3377 context()->Plug(v0); | 3377 context()->Plug(v0); |
3378 } | 3378 } |
3379 | 3379 |
3380 | 3380 |
3381 void FullCodeGenerator::EmitRandomHeapNumber(CallRuntime* expr) { | |
3382 ASSERT(expr->arguments()->length() == 0); | |
3383 Label slow_allocate_heapnumber; | |
3384 Label heapnumber_allocated; | |
3385 | |
3386 // Save the new heap number in callee-saved register s0, since | |
3387 // we call out to external C code below. | |
3388 __ LoadRoot(t6, Heap::kHeapNumberMapRootIndex); | |
3389 __ AllocateHeapNumber(s0, a1, a2, t6, &slow_allocate_heapnumber); | |
3390 __ jmp(&heapnumber_allocated); | |
3391 | |
3392 __ bind(&slow_allocate_heapnumber); | |
3393 | |
3394 // Allocate a heap number. | |
3395 __ CallRuntime(Runtime::kNumberAlloc, 0); | |
3396 __ mov(s0, v0); // Save result in s0, so it is saved thru CFunc call. | |
3397 | |
3398 __ bind(&heapnumber_allocated); | |
3399 | |
3400 // Convert 32 random bits in v0 to 0.(32 random bits) in a double | |
3401 // by computing: | |
3402 // ( 1.(20 0s)(32 random bits) x 2^20 ) - (1.0 x 2^20)). | |
3403 __ PrepareCallCFunction(1, a0); | |
3404 __ lw(a0, ContextOperand(cp, Context::GLOBAL_OBJECT_INDEX)); | |
3405 __ lw(a0, FieldMemOperand(a0, GlobalObject::kNativeContextOffset)); | |
3406 __ CallCFunction(ExternalReference::random_uint32_function(isolate()), 1); | |
3407 | |
3408 // 0x41300000 is the top half of 1.0 x 2^20 as a double. | |
3409 __ li(a1, Operand(0x41300000)); | |
3410 // Move 0x41300000xxxxxxxx (x = random bits in v0) to FPU. | |
3411 __ Move(f12, v0, a1); | |
3412 // Move 0x4130000000000000 to FPU. | |
3413 __ Move(f14, zero_reg, a1); | |
3414 // Subtract and store the result in the heap number. | |
3415 __ sub_d(f0, f12, f14); | |
3416 __ sdc1(f0, FieldMemOperand(s0, HeapNumber::kValueOffset)); | |
3417 __ mov(v0, s0); | |
3418 | |
3419 context()->Plug(v0); | |
3420 } | |
3421 | |
3422 | |
3423 void FullCodeGenerator::EmitSubString(CallRuntime* expr) { | 3381 void FullCodeGenerator::EmitSubString(CallRuntime* expr) { |
3424 // Load the arguments on the stack and call the stub. | 3382 // Load the arguments on the stack and call the stub. |
3425 SubStringStub stub; | 3383 SubStringStub stub; |
3426 ZoneList<Expression*>* args = expr->arguments(); | 3384 ZoneList<Expression*>* args = expr->arguments(); |
3427 ASSERT(args->length() == 3); | 3385 ASSERT(args->length() == 3); |
3428 VisitForStackValue(args->at(0)); | 3386 VisitForStackValue(args->at(0)); |
3429 VisitForStackValue(args->at(1)); | 3387 VisitForStackValue(args->at(1)); |
3430 VisitForStackValue(args->at(2)); | 3388 VisitForStackValue(args->at(2)); |
3431 __ CallStub(&stub); | 3389 __ CallStub(&stub); |
3432 context()->Plug(v0); | 3390 context()->Plug(v0); |
(...skipping 1574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5007 Assembler::target_address_at(pc_immediate_load_address)) == | 4965 Assembler::target_address_at(pc_immediate_load_address)) == |
5008 reinterpret_cast<uint32_t>( | 4966 reinterpret_cast<uint32_t>( |
5009 isolate->builtins()->OsrAfterStackCheck()->entry())); | 4967 isolate->builtins()->OsrAfterStackCheck()->entry())); |
5010 return OSR_AFTER_STACK_CHECK; | 4968 return OSR_AFTER_STACK_CHECK; |
5011 } | 4969 } |
5012 | 4970 |
5013 | 4971 |
5014 } } // namespace v8::internal | 4972 } } // namespace v8::internal |
5015 | 4973 |
5016 #endif // V8_TARGET_ARCH_MIPS | 4974 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |