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 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
426 ? DefineDeoptimizationLiteral(environment->closure()) | 426 ? DefineDeoptimizationLiteral(environment->closure()) |
427 : Translation::kSelfLiteralId; | 427 : Translation::kSelfLiteralId; |
428 switch (environment->frame_type()) { | 428 switch (environment->frame_type()) { |
429 case JS_FUNCTION: | 429 case JS_FUNCTION: |
430 translation->BeginJSFrame(environment->ast_id(), closure_id, height); | 430 translation->BeginJSFrame(environment->ast_id(), closure_id, height); |
431 break; | 431 break; |
432 case JS_CONSTRUCT: | 432 case JS_CONSTRUCT: |
433 translation->BeginConstructStubFrame(closure_id, translation_size); | 433 translation->BeginConstructStubFrame(closure_id, translation_size); |
434 break; | 434 break; |
435 case JS_SETTER: | 435 case JS_SETTER: |
436 ASSERT(translation_size == 2); | 436 // TODO(svenpanne) Implement me! |
437 ASSERT(height == 0); | |
438 translation->BeginSetterStubFrame(closure_id); | |
439 break; | 437 break; |
440 case ARGUMENTS_ADAPTOR: | 438 case ARGUMENTS_ADAPTOR: |
441 translation->BeginArgumentsAdaptorFrame(closure_id, translation_size); | 439 translation->BeginArgumentsAdaptorFrame(closure_id, translation_size); |
442 break; | 440 break; |
443 } | 441 } |
444 for (int i = 0; i < translation_size; ++i) { | 442 for (int i = 0; i < translation_size; ++i) { |
445 LOperand* value = environment->values()->at(i); | 443 LOperand* value = environment->values()->at(i); |
446 // spilled_registers_ and spilled_double_registers_ are either | 444 // spilled_registers_ and spilled_double_registers_ are either |
447 // both NULL or both set. | 445 // both NULL or both set. |
448 if (environment->spilled_registers() != NULL && value != NULL) { | 446 if (environment->spilled_registers() != NULL && value != NULL) { |
(...skipping 2506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2955 DeoptimizeIf(equal, instr->environment()); | 2953 DeoptimizeIf(equal, instr->environment()); |
2956 __ CmpObjectType(receiver, FIRST_SPEC_OBJECT_TYPE, scratch); | 2954 __ CmpObjectType(receiver, FIRST_SPEC_OBJECT_TYPE, scratch); |
2957 DeoptimizeIf(below, instr->environment()); | 2955 DeoptimizeIf(below, instr->environment()); |
2958 __ jmp(&receiver_ok, Label::kNear); | 2956 __ jmp(&receiver_ok, Label::kNear); |
2959 | 2957 |
2960 __ bind(&global_object); | 2958 __ bind(&global_object); |
2961 // TODO(kmillikin): We have a hydrogen value for the global object. See | 2959 // TODO(kmillikin): We have a hydrogen value for the global object. See |
2962 // if it's better to use it than to explicitly fetch it from the context | 2960 // if it's better to use it than to explicitly fetch it from the context |
2963 // here. | 2961 // here. |
2964 __ mov(receiver, Operand(ebp, StandardFrameConstants::kContextOffset)); | 2962 __ mov(receiver, Operand(ebp, StandardFrameConstants::kContextOffset)); |
2965 __ mov(receiver, ContextOperand(receiver, Context::GLOBAL_OBJECT_INDEX)); | 2963 __ mov(receiver, ContextOperand(receiver, Context::GLOBAL_INDEX)); |
2966 __ mov(receiver, | 2964 __ mov(receiver, |
2967 FieldOperand(receiver, JSGlobalObject::kGlobalReceiverOffset)); | 2965 FieldOperand(receiver, JSGlobalObject::kGlobalReceiverOffset)); |
2968 __ bind(&receiver_ok); | 2966 __ bind(&receiver_ok); |
2969 } | 2967 } |
2970 | 2968 |
2971 | 2969 |
2972 void LCodeGen::DoApplyArguments(LApplyArguments* instr) { | 2970 void LCodeGen::DoApplyArguments(LApplyArguments* instr) { |
2973 Register receiver = ToRegister(instr->receiver()); | 2971 Register receiver = ToRegister(instr->receiver()); |
2974 Register function = ToRegister(instr->function()); | 2972 Register function = ToRegister(instr->function()); |
2975 Register length = ToRegister(instr->length()); | 2973 Register length = ToRegister(instr->length()); |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3047 __ push(esi); // The context is the first argument. | 3045 __ push(esi); // The context is the first argument. |
3048 __ push(Immediate(instr->hydrogen()->pairs())); | 3046 __ push(Immediate(instr->hydrogen()->pairs())); |
3049 __ push(Immediate(Smi::FromInt(instr->hydrogen()->flags()))); | 3047 __ push(Immediate(Smi::FromInt(instr->hydrogen()->flags()))); |
3050 CallRuntime(Runtime::kDeclareGlobals, 3, instr); | 3048 CallRuntime(Runtime::kDeclareGlobals, 3, instr); |
3051 } | 3049 } |
3052 | 3050 |
3053 | 3051 |
3054 void LCodeGen::DoGlobalObject(LGlobalObject* instr) { | 3052 void LCodeGen::DoGlobalObject(LGlobalObject* instr) { |
3055 Register context = ToRegister(instr->context()); | 3053 Register context = ToRegister(instr->context()); |
3056 Register result = ToRegister(instr->result()); | 3054 Register result = ToRegister(instr->result()); |
3057 __ mov(result, | 3055 __ mov(result, Operand(context, Context::SlotOffset(Context::GLOBAL_INDEX))); |
3058 Operand(context, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); | |
3059 } | 3056 } |
3060 | 3057 |
3061 | 3058 |
3062 void LCodeGen::DoGlobalReceiver(LGlobalReceiver* instr) { | 3059 void LCodeGen::DoGlobalReceiver(LGlobalReceiver* instr) { |
3063 Register global = ToRegister(instr->global()); | 3060 Register global = ToRegister(instr->global()); |
3064 Register result = ToRegister(instr->result()); | 3061 Register result = ToRegister(instr->result()); |
3065 __ mov(result, FieldOperand(global, GlobalObject::kGlobalReceiverOffset)); | 3062 __ mov(result, FieldOperand(global, GlobalObject::kGlobalReceiverOffset)); |
3066 } | 3063 } |
3067 | 3064 |
3068 | 3065 |
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3416 DeferredDoRandom* deferred = new(zone()) DeferredDoRandom(this, instr); | 3413 DeferredDoRandom* deferred = new(zone()) DeferredDoRandom(this, instr); |
3417 | 3414 |
3418 // Having marked this instruction as a call we can use any | 3415 // Having marked this instruction as a call we can use any |
3419 // registers. | 3416 // registers. |
3420 ASSERT(ToDoubleRegister(instr->result()).is(xmm1)); | 3417 ASSERT(ToDoubleRegister(instr->result()).is(xmm1)); |
3421 ASSERT(ToRegister(instr->InputAt(0)).is(eax)); | 3418 ASSERT(ToRegister(instr->InputAt(0)).is(eax)); |
3422 // Assert that the register size is indeed the size of each seed. | 3419 // Assert that the register size is indeed the size of each seed. |
3423 static const int kSeedSize = sizeof(uint32_t); | 3420 static const int kSeedSize = sizeof(uint32_t); |
3424 STATIC_ASSERT(kPointerSize == kSeedSize); | 3421 STATIC_ASSERT(kPointerSize == kSeedSize); |
3425 | 3422 |
3426 __ mov(eax, FieldOperand(eax, GlobalObject::kNativeContextOffset)); | 3423 __ mov(eax, FieldOperand(eax, GlobalObject::kGlobalContextOffset)); |
3427 static const int kRandomSeedOffset = | 3424 static const int kRandomSeedOffset = |
3428 FixedArray::kHeaderSize + Context::RANDOM_SEED_INDEX * kPointerSize; | 3425 FixedArray::kHeaderSize + Context::RANDOM_SEED_INDEX * kPointerSize; |
3429 __ mov(ebx, FieldOperand(eax, kRandomSeedOffset)); | 3426 __ mov(ebx, FieldOperand(eax, kRandomSeedOffset)); |
3430 // ebx: FixedArray of the native context's random seeds | 3427 // ebx: FixedArray of the global context's random seeds |
3431 | 3428 |
3432 // Load state[0]. | 3429 // Load state[0]. |
3433 __ mov(ecx, FieldOperand(ebx, ByteArray::kHeaderSize)); | 3430 __ mov(ecx, FieldOperand(ebx, ByteArray::kHeaderSize)); |
3434 // If state[0] == 0, call runtime to initialize seeds. | 3431 // If state[0] == 0, call runtime to initialize seeds. |
3435 __ test(ecx, ecx); | 3432 __ test(ecx, ecx); |
3436 __ j(zero, deferred->entry()); | 3433 __ j(zero, deferred->entry()); |
3437 // Load state[1]. | 3434 // Load state[1]. |
3438 __ mov(eax, FieldOperand(ebx, ByteArray::kHeaderSize + kSeedSize)); | 3435 __ mov(eax, FieldOperand(ebx, ByteArray::kHeaderSize + kSeedSize)); |
3439 // ecx: state[0] | 3436 // ecx: state[0] |
3440 // eax: state[1] | 3437 // eax: state[1] |
(...skipping 1984 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5425 FixedArray::kHeaderSize - kPointerSize)); | 5422 FixedArray::kHeaderSize - kPointerSize)); |
5426 __ bind(&done); | 5423 __ bind(&done); |
5427 } | 5424 } |
5428 | 5425 |
5429 | 5426 |
5430 #undef __ | 5427 #undef __ |
5431 | 5428 |
5432 } } // namespace v8::internal | 5429 } } // namespace v8::internal |
5433 | 5430 |
5434 #endif // V8_TARGET_ARCH_IA32 | 5431 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |