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