Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(232)

Side by Side Diff: src/x64/lithium-codegen-x64.cc

Issue 6903060: Version 3.3.2.... (Closed) Base URL: http://v8.googlecode.com/svn/trunk/
Patch Set: '' Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/version.cc ('k') | src/x64/lithium-x64.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 2332 matching lines...) Expand 10 before | Expand all | Expand 10 after
2343 2343
2344 void LCodeGen::DoLoadKeyedSpecializedArrayElement( 2344 void LCodeGen::DoLoadKeyedSpecializedArrayElement(
2345 LLoadKeyedSpecializedArrayElement* instr) { 2345 LLoadKeyedSpecializedArrayElement* instr) {
2346 Register external_pointer = ToRegister(instr->external_pointer()); 2346 Register external_pointer = ToRegister(instr->external_pointer());
2347 Register key = ToRegister(instr->key()); 2347 Register key = ToRegister(instr->key());
2348 ExternalArrayType array_type = instr->array_type(); 2348 ExternalArrayType array_type = instr->array_type();
2349 if (array_type == kExternalFloatArray) { 2349 if (array_type == kExternalFloatArray) {
2350 XMMRegister result(ToDoubleRegister(instr->result())); 2350 XMMRegister result(ToDoubleRegister(instr->result()));
2351 __ movss(result, Operand(external_pointer, key, times_4, 0)); 2351 __ movss(result, Operand(external_pointer, key, times_4, 0));
2352 __ cvtss2sd(result, result); 2352 __ cvtss2sd(result, result);
2353 } else if (array_type == kExternalDoubleArray) {
2354 __ movsd(ToDoubleRegister(instr->result()),
2355 Operand(external_pointer, key, times_8, 0));
2353 } else { 2356 } else {
2354 Register result(ToRegister(instr->result())); 2357 Register result(ToRegister(instr->result()));
2355 switch (array_type) { 2358 switch (array_type) {
2356 case kExternalByteArray: 2359 case kExternalByteArray:
2357 __ movsxbq(result, Operand(external_pointer, key, times_1, 0)); 2360 __ movsxbq(result, Operand(external_pointer, key, times_1, 0));
2358 break; 2361 break;
2359 case kExternalUnsignedByteArray: 2362 case kExternalUnsignedByteArray:
2360 case kExternalPixelArray: 2363 case kExternalPixelArray:
2361 __ movzxbq(result, Operand(external_pointer, key, times_1, 0)); 2364 __ movzxbq(result, Operand(external_pointer, key, times_1, 0));
2362 break; 2365 break;
2363 case kExternalShortArray: 2366 case kExternalShortArray:
2364 __ movsxwq(result, Operand(external_pointer, key, times_2, 0)); 2367 __ movsxwq(result, Operand(external_pointer, key, times_2, 0));
2365 break; 2368 break;
2366 case kExternalUnsignedShortArray: 2369 case kExternalUnsignedShortArray:
2367 __ movzxwq(result, Operand(external_pointer, key, times_2, 0)); 2370 __ movzxwq(result, Operand(external_pointer, key, times_2, 0));
2368 break; 2371 break;
2369 case kExternalIntArray: 2372 case kExternalIntArray:
2370 __ movsxlq(result, Operand(external_pointer, key, times_4, 0)); 2373 __ movsxlq(result, Operand(external_pointer, key, times_4, 0));
2371 break; 2374 break;
2372 case kExternalUnsignedIntArray: 2375 case kExternalUnsignedIntArray:
2373 __ movl(result, Operand(external_pointer, key, times_4, 0)); 2376 __ movl(result, Operand(external_pointer, key, times_4, 0));
2374 __ testl(result, result); 2377 __ testl(result, result);
2375 // TODO(danno): we could be more clever here, perhaps having a special 2378 // TODO(danno): we could be more clever here, perhaps having a special
2376 // version of the stub that detects if the overflow case actually 2379 // version of the stub that detects if the overflow case actually
2377 // happens, and generate code that returns a double rather than int. 2380 // happens, and generate code that returns a double rather than int.
2378 DeoptimizeIf(negative, instr->environment()); 2381 DeoptimizeIf(negative, instr->environment());
2379 break; 2382 break;
2380 case kExternalFloatArray: 2383 case kExternalFloatArray:
2384 case kExternalDoubleArray:
2381 UNREACHABLE(); 2385 UNREACHABLE();
2382 break; 2386 break;
2383 } 2387 }
2384 } 2388 }
2385 } 2389 }
2386 2390
2387 2391
2388 void LCodeGen::DoLoadKeyedGeneric(LLoadKeyedGeneric* instr) { 2392 void LCodeGen::DoLoadKeyedGeneric(LLoadKeyedGeneric* instr) {
2389 ASSERT(ToRegister(instr->object()).is(rdx)); 2393 ASSERT(ToRegister(instr->object()).is(rdx));
2390 ASSERT(ToRegister(instr->key()).is(rax)); 2394 ASSERT(ToRegister(instr->key()).is(rax));
(...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after
3030 3034
3031 void LCodeGen::DoStoreKeyedSpecializedArrayElement( 3035 void LCodeGen::DoStoreKeyedSpecializedArrayElement(
3032 LStoreKeyedSpecializedArrayElement* instr) { 3036 LStoreKeyedSpecializedArrayElement* instr) {
3033 Register external_pointer = ToRegister(instr->external_pointer()); 3037 Register external_pointer = ToRegister(instr->external_pointer());
3034 Register key = ToRegister(instr->key()); 3038 Register key = ToRegister(instr->key());
3035 ExternalArrayType array_type = instr->array_type(); 3039 ExternalArrayType array_type = instr->array_type();
3036 if (array_type == kExternalFloatArray) { 3040 if (array_type == kExternalFloatArray) {
3037 XMMRegister value(ToDoubleRegister(instr->value())); 3041 XMMRegister value(ToDoubleRegister(instr->value()));
3038 __ cvtsd2ss(value, value); 3042 __ cvtsd2ss(value, value);
3039 __ movss(Operand(external_pointer, key, times_4, 0), value); 3043 __ movss(Operand(external_pointer, key, times_4, 0), value);
3044 } else if (array_type == kExternalDoubleArray) {
3045 __ movsd(Operand(external_pointer, key, times_8, 0),
3046 ToDoubleRegister(instr->value()));
3040 } else { 3047 } else {
3041 Register value(ToRegister(instr->value())); 3048 Register value(ToRegister(instr->value()));
3042 switch (array_type) { 3049 switch (array_type) {
3043 case kExternalPixelArray: 3050 case kExternalPixelArray:
3044 { // Clamp the value to [0..255]. 3051 { // Clamp the value to [0..255].
3045 NearLabel done; 3052 NearLabel done;
3046 __ testl(value, Immediate(0xFFFFFF00)); 3053 __ testl(value, Immediate(0xFFFFFF00));
3047 __ j(zero, &done); 3054 __ j(zero, &done);
3048 __ setcc(negative, value); // 1 if negative, 0 if positive. 3055 __ setcc(negative, value); // 1 if negative, 0 if positive.
3049 __ decb(value); // 0 if negative, 255 if positive. 3056 __ decb(value); // 0 if negative, 255 if positive.
3050 __ bind(&done); 3057 __ bind(&done);
3051 __ movb(Operand(external_pointer, key, times_1, 0), value); 3058 __ movb(Operand(external_pointer, key, times_1, 0), value);
3052 } 3059 }
3053 break; 3060 break;
3054 case kExternalByteArray: 3061 case kExternalByteArray:
3055 case kExternalUnsignedByteArray: 3062 case kExternalUnsignedByteArray:
3056 __ movb(Operand(external_pointer, key, times_1, 0), value); 3063 __ movb(Operand(external_pointer, key, times_1, 0), value);
3057 break; 3064 break;
3058 case kExternalShortArray: 3065 case kExternalShortArray:
3059 case kExternalUnsignedShortArray: 3066 case kExternalUnsignedShortArray:
3060 __ movw(Operand(external_pointer, key, times_2, 0), value); 3067 __ movw(Operand(external_pointer, key, times_2, 0), value);
3061 break; 3068 break;
3062 case kExternalIntArray: 3069 case kExternalIntArray:
3063 case kExternalUnsignedIntArray: 3070 case kExternalUnsignedIntArray:
3064 __ movl(Operand(external_pointer, key, times_4, 0), value); 3071 __ movl(Operand(external_pointer, key, times_4, 0), value);
3065 break; 3072 break;
3066 case kExternalFloatArray: 3073 case kExternalFloatArray:
3074 case kExternalDoubleArray:
3067 UNREACHABLE(); 3075 UNREACHABLE();
3068 break; 3076 break;
3069 } 3077 }
3070 } 3078 }
3071 } 3079 }
3072 3080
3073 3081
3074 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { 3082 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) {
3075 if (instr->length()->IsRegister()) { 3083 if (instr->length()->IsRegister()) {
3076 __ cmpq(ToRegister(instr->index()), ToRegister(instr->length())); 3084 __ cmpq(ToRegister(instr->index()), ToRegister(instr->length()));
(...skipping 906 matching lines...) Expand 10 before | Expand all | Expand 10 after
3983 // reloc info for patching in deoptimization (since this is invoking a 3991 // reloc info for patching in deoptimization (since this is invoking a
3984 // builtin) 3992 // builtin)
3985 SafepointGenerator safepoint_generator(this, 3993 SafepointGenerator safepoint_generator(this,
3986 pointers, 3994 pointers,
3987 env->deoptimization_index()); 3995 env->deoptimization_index());
3988 __ Push(Smi::FromInt(strict_mode_flag())); 3996 __ Push(Smi::FromInt(strict_mode_flag()));
3989 __ InvokeBuiltin(Builtins::DELETE, CALL_FUNCTION, &safepoint_generator); 3997 __ InvokeBuiltin(Builtins::DELETE, CALL_FUNCTION, &safepoint_generator);
3990 } 3998 }
3991 3999
3992 4000
4001 void LCodeGen::DoIn(LIn* instr) {
4002 LOperand* obj = instr->object();
4003 LOperand* key = instr->key();
4004 EmitPushTaggedOperand(key);
4005 EmitPushTaggedOperand(obj);
4006 ASSERT(instr->HasPointerMap() && instr->HasDeoptimizationEnvironment());
4007 LPointerMap* pointers = instr->pointer_map();
4008 LEnvironment* env = instr->deoptimization_environment();
4009 RecordPosition(pointers->position());
4010 RegisterEnvironmentForDeoptimization(env);
4011 // Create safepoint generator that will also ensure enough space in the
4012 // reloc info for patching in deoptimization (since this is invoking a
4013 // builtin)
4014 SafepointGenerator safepoint_generator(this,
4015 pointers,
4016 env->deoptimization_index());
4017 __ InvokeBuiltin(Builtins::IN, CALL_FUNCTION, &safepoint_generator);
4018 }
4019
4020
3993 void LCodeGen::DoStackCheck(LStackCheck* instr) { 4021 void LCodeGen::DoStackCheck(LStackCheck* instr) {
3994 // Perform stack overflow check. 4022 // Perform stack overflow check.
3995 NearLabel done; 4023 NearLabel done;
3996 __ CompareRoot(rsp, Heap::kStackLimitRootIndex); 4024 __ CompareRoot(rsp, Heap::kStackLimitRootIndex);
3997 __ j(above_equal, &done); 4025 __ j(above_equal, &done);
3998 4026
3999 StackCheckStub stub; 4027 StackCheckStub stub;
4000 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); 4028 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
4001 __ bind(&done); 4029 __ bind(&done);
4002 } 4030 }
(...skipping 13 matching lines...) Expand all
4016 RegisterEnvironmentForDeoptimization(environment); 4044 RegisterEnvironmentForDeoptimization(environment);
4017 ASSERT(osr_pc_offset_ == -1); 4045 ASSERT(osr_pc_offset_ == -1);
4018 osr_pc_offset_ = masm()->pc_offset(); 4046 osr_pc_offset_ = masm()->pc_offset();
4019 } 4047 }
4020 4048
4021 #undef __ 4049 #undef __
4022 4050
4023 } } // namespace v8::internal 4051 } } // namespace v8::internal
4024 4052
4025 #endif // V8_TARGET_ARCH_X64 4053 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/version.cc ('k') | src/x64/lithium-x64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698