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 3347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3358 | 3358 |
3359 DeferredDoRandom* deferred = new(zone()) DeferredDoRandom(this, instr); | 3359 DeferredDoRandom* deferred = new(zone()) DeferredDoRandom(this, instr); |
3360 // Having marked this instruction as a call we can use any | 3360 // Having marked this instruction as a call we can use any |
3361 // registers. | 3361 // registers. |
3362 ASSERT(ToDoubleRegister(instr->result()).is(f0)); | 3362 ASSERT(ToDoubleRegister(instr->result()).is(f0)); |
3363 ASSERT(ToRegister(instr->InputAt(0)).is(a0)); | 3363 ASSERT(ToRegister(instr->InputAt(0)).is(a0)); |
3364 | 3364 |
3365 static const int kSeedSize = sizeof(uint32_t); | 3365 static const int kSeedSize = sizeof(uint32_t); |
3366 STATIC_ASSERT(kPointerSize == kSeedSize); | 3366 STATIC_ASSERT(kPointerSize == kSeedSize); |
3367 | 3367 |
3368 __ lw(a0, FieldMemOperand(a0, GlobalObject::kGlobalContextOffset)); | 3368 __ lw(a0, FieldMemOperand(a0, GlobalObject::kNativeContextOffset)); |
3369 static const int kRandomSeedOffset = | 3369 static const int kRandomSeedOffset = |
3370 FixedArray::kHeaderSize + Context::RANDOM_SEED_INDEX * kPointerSize; | 3370 FixedArray::kHeaderSize + Context::RANDOM_SEED_INDEX * kPointerSize; |
3371 __ lw(a2, FieldMemOperand(a0, kRandomSeedOffset)); | 3371 __ lw(a2, FieldMemOperand(a0, kRandomSeedOffset)); |
3372 // a2: FixedArray of the global context's random seeds | 3372 // a2: FixedArray of the native context's random seeds |
3373 | 3373 |
3374 // Load state[0]. | 3374 // Load state[0]. |
3375 __ lw(a1, FieldMemOperand(a2, ByteArray::kHeaderSize)); | 3375 __ lw(a1, FieldMemOperand(a2, ByteArray::kHeaderSize)); |
3376 __ Branch(deferred->entry(), eq, a1, Operand(zero_reg)); | 3376 __ Branch(deferred->entry(), eq, a1, Operand(zero_reg)); |
3377 // Load state[1]. | 3377 // Load state[1]. |
3378 __ lw(a0, FieldMemOperand(a2, ByteArray::kHeaderSize + kSeedSize)); | 3378 __ lw(a0, FieldMemOperand(a2, ByteArray::kHeaderSize + kSeedSize)); |
3379 // a1: state[0]. | 3379 // a1: state[0]. |
3380 // a0: state[1]. | 3380 // a0: state[1]. |
3381 | 3381 |
3382 // state[0] = 18273 * (state[0] & 0xFFFF) + (state[0] >> 16) | 3382 // state[0] = 18273 * (state[0] & 0xFFFF) + (state[0] >> 16) |
(...skipping 1945 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5328 __ Subu(scratch, result, scratch); | 5328 __ Subu(scratch, result, scratch); |
5329 __ lw(result, FieldMemOperand(scratch, | 5329 __ lw(result, FieldMemOperand(scratch, |
5330 FixedArray::kHeaderSize - kPointerSize)); | 5330 FixedArray::kHeaderSize - kPointerSize)); |
5331 __ bind(&done); | 5331 __ bind(&done); |
5332 } | 5332 } |
5333 | 5333 |
5334 | 5334 |
5335 #undef __ | 5335 #undef __ |
5336 | 5336 |
5337 } } // namespace v8::internal | 5337 } } // namespace v8::internal |
OLD | NEW |