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 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
455 : Translation::kSelfLiteralId; | 455 : Translation::kSelfLiteralId; |
456 | 456 |
457 switch (environment->frame_type()) { | 457 switch (environment->frame_type()) { |
458 case JS_FUNCTION: | 458 case JS_FUNCTION: |
459 translation->BeginJSFrame(environment->ast_id(), closure_id, height); | 459 translation->BeginJSFrame(environment->ast_id(), closure_id, height); |
460 break; | 460 break; |
461 case JS_CONSTRUCT: | 461 case JS_CONSTRUCT: |
462 translation->BeginConstructStubFrame(closure_id, translation_size); | 462 translation->BeginConstructStubFrame(closure_id, translation_size); |
463 break; | 463 break; |
464 case JS_SETTER: | 464 case JS_SETTER: |
465 ASSERT(translation_size == 2); | 465 // TODO(svenpanne) Implement me! |
466 ASSERT(height == 0); | |
467 translation->BeginSetterStubFrame(closure_id); | |
468 break; | 466 break; |
469 case ARGUMENTS_ADAPTOR: | 467 case ARGUMENTS_ADAPTOR: |
470 translation->BeginArgumentsAdaptorFrame(closure_id, translation_size); | 468 translation->BeginArgumentsAdaptorFrame(closure_id, translation_size); |
471 break; | 469 break; |
472 } | 470 } |
473 for (int i = 0; i < translation_size; ++i) { | 471 for (int i = 0; i < translation_size; ++i) { |
474 LOperand* value = environment->values()->at(i); | 472 LOperand* value = environment->values()->at(i); |
475 // spilled_registers_ and spilled_double_registers_ are either | 473 // spilled_registers_ and spilled_double_registers_ are either |
476 // both NULL or both set. | 474 // both NULL or both set. |
477 if (environment->spilled_registers() != NULL && value != NULL) { | 475 if (environment->spilled_registers() != NULL && value != NULL) { |
(...skipping 2512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2990 __ LoadHeapObject(scratch0(), instr->hydrogen()->pairs()); | 2988 __ LoadHeapObject(scratch0(), instr->hydrogen()->pairs()); |
2991 __ li(scratch1(), Operand(Smi::FromInt(instr->hydrogen()->flags()))); | 2989 __ li(scratch1(), Operand(Smi::FromInt(instr->hydrogen()->flags()))); |
2992 // The context is the first argument. | 2990 // The context is the first argument. |
2993 __ Push(cp, scratch0(), scratch1()); | 2991 __ Push(cp, scratch0(), scratch1()); |
2994 CallRuntime(Runtime::kDeclareGlobals, 3, instr); | 2992 CallRuntime(Runtime::kDeclareGlobals, 3, instr); |
2995 } | 2993 } |
2996 | 2994 |
2997 | 2995 |
2998 void LCodeGen::DoGlobalObject(LGlobalObject* instr) { | 2996 void LCodeGen::DoGlobalObject(LGlobalObject* instr) { |
2999 Register result = ToRegister(instr->result()); | 2997 Register result = ToRegister(instr->result()); |
3000 __ lw(result, ContextOperand(cp, Context::GLOBAL_OBJECT_INDEX)); | 2998 __ lw(result, ContextOperand(cp, Context::GLOBAL_INDEX)); |
3001 } | 2999 } |
3002 | 3000 |
3003 | 3001 |
3004 void LCodeGen::DoGlobalReceiver(LGlobalReceiver* instr) { | 3002 void LCodeGen::DoGlobalReceiver(LGlobalReceiver* instr) { |
3005 Register global = ToRegister(instr->global()); | 3003 Register global = ToRegister(instr->global()); |
3006 Register result = ToRegister(instr->result()); | 3004 Register result = ToRegister(instr->result()); |
3007 __ lw(result, FieldMemOperand(global, GlobalObject::kGlobalReceiverOffset)); | 3005 __ lw(result, FieldMemOperand(global, GlobalObject::kGlobalReceiverOffset)); |
3008 } | 3006 } |
3009 | 3007 |
3010 | 3008 |
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3360 | 3358 |
3361 DeferredDoRandom* deferred = new(zone()) DeferredDoRandom(this, instr); | 3359 DeferredDoRandom* deferred = new(zone()) DeferredDoRandom(this, instr); |
3362 // Having marked this instruction as a call we can use any | 3360 // Having marked this instruction as a call we can use any |
3363 // registers. | 3361 // registers. |
3364 ASSERT(ToDoubleRegister(instr->result()).is(f0)); | 3362 ASSERT(ToDoubleRegister(instr->result()).is(f0)); |
3365 ASSERT(ToRegister(instr->InputAt(0)).is(a0)); | 3363 ASSERT(ToRegister(instr->InputAt(0)).is(a0)); |
3366 | 3364 |
3367 static const int kSeedSize = sizeof(uint32_t); | 3365 static const int kSeedSize = sizeof(uint32_t); |
3368 STATIC_ASSERT(kPointerSize == kSeedSize); | 3366 STATIC_ASSERT(kPointerSize == kSeedSize); |
3369 | 3367 |
3370 __ lw(a0, FieldMemOperand(a0, GlobalObject::kNativeContextOffset)); | 3368 __ lw(a0, FieldMemOperand(a0, GlobalObject::kGlobalContextOffset)); |
3371 static const int kRandomSeedOffset = | 3369 static const int kRandomSeedOffset = |
3372 FixedArray::kHeaderSize + Context::RANDOM_SEED_INDEX * kPointerSize; | 3370 FixedArray::kHeaderSize + Context::RANDOM_SEED_INDEX * kPointerSize; |
3373 __ lw(a2, FieldMemOperand(a0, kRandomSeedOffset)); | 3371 __ lw(a2, FieldMemOperand(a0, kRandomSeedOffset)); |
3374 // a2: FixedArray of the native context's random seeds | 3372 // a2: FixedArray of the global context's random seeds |
3375 | 3373 |
3376 // Load state[0]. | 3374 // Load state[0]. |
3377 __ lw(a1, FieldMemOperand(a2, ByteArray::kHeaderSize)); | 3375 __ lw(a1, FieldMemOperand(a2, ByteArray::kHeaderSize)); |
3378 __ Branch(deferred->entry(), eq, a1, Operand(zero_reg)); | 3376 __ Branch(deferred->entry(), eq, a1, Operand(zero_reg)); |
3379 // Load state[1]. | 3377 // Load state[1]. |
3380 __ lw(a0, FieldMemOperand(a2, ByteArray::kHeaderSize + kSeedSize)); | 3378 __ lw(a0, FieldMemOperand(a2, ByteArray::kHeaderSize + kSeedSize)); |
3381 // a1: state[0]. | 3379 // a1: state[0]. |
3382 // a0: state[1]. | 3380 // a0: state[1]. |
3383 | 3381 |
3384 // 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... |
5330 __ Subu(scratch, result, scratch); | 5328 __ Subu(scratch, result, scratch); |
5331 __ lw(result, FieldMemOperand(scratch, | 5329 __ lw(result, FieldMemOperand(scratch, |
5332 FixedArray::kHeaderSize - kPointerSize)); | 5330 FixedArray::kHeaderSize - kPointerSize)); |
5333 __ bind(&done); | 5331 __ bind(&done); |
5334 } | 5332 } |
5335 | 5333 |
5336 | 5334 |
5337 #undef __ | 5335 #undef __ |
5338 | 5336 |
5339 } } // namespace v8::internal | 5337 } } // namespace v8::internal |
OLD | NEW |