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

Side by Side Diff: src/ia32/lithium-codegen-ia32.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/hydrogen-instructions.cc ('k') | src/ia32/lithium-ia32.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 2320 matching lines...) Expand 10 before | Expand all | Expand 10 after
2331 2331
2332 void LCodeGen::DoLoadKeyedSpecializedArrayElement( 2332 void LCodeGen::DoLoadKeyedSpecializedArrayElement(
2333 LLoadKeyedSpecializedArrayElement* instr) { 2333 LLoadKeyedSpecializedArrayElement* instr) {
2334 Register external_pointer = ToRegister(instr->external_pointer()); 2334 Register external_pointer = ToRegister(instr->external_pointer());
2335 Register key = ToRegister(instr->key()); 2335 Register key = ToRegister(instr->key());
2336 ExternalArrayType array_type = instr->array_type(); 2336 ExternalArrayType array_type = instr->array_type();
2337 if (array_type == kExternalFloatArray) { 2337 if (array_type == kExternalFloatArray) {
2338 XMMRegister result(ToDoubleRegister(instr->result())); 2338 XMMRegister result(ToDoubleRegister(instr->result()));
2339 __ movss(result, Operand(external_pointer, key, times_4, 0)); 2339 __ movss(result, Operand(external_pointer, key, times_4, 0));
2340 __ cvtss2sd(result, result); 2340 __ cvtss2sd(result, result);
2341 } else if (array_type == kExternalDoubleArray) {
2342 __ movdbl(ToDoubleRegister(instr->result()),
2343 Operand(external_pointer, key, times_8, 0));
2341 } else { 2344 } else {
2342 Register result(ToRegister(instr->result())); 2345 Register result(ToRegister(instr->result()));
2343 switch (array_type) { 2346 switch (array_type) {
2344 case kExternalByteArray: 2347 case kExternalByteArray:
2345 __ movsx_b(result, Operand(external_pointer, key, times_1, 0)); 2348 __ movsx_b(result, Operand(external_pointer, key, times_1, 0));
2346 break; 2349 break;
2347 case kExternalUnsignedByteArray: 2350 case kExternalUnsignedByteArray:
2348 case kExternalPixelArray: 2351 case kExternalPixelArray:
2349 __ movzx_b(result, Operand(external_pointer, key, times_1, 0)); 2352 __ movzx_b(result, Operand(external_pointer, key, times_1, 0));
2350 break; 2353 break;
2351 case kExternalShortArray: 2354 case kExternalShortArray:
2352 __ movsx_w(result, Operand(external_pointer, key, times_2, 0)); 2355 __ movsx_w(result, Operand(external_pointer, key, times_2, 0));
2353 break; 2356 break;
2354 case kExternalUnsignedShortArray: 2357 case kExternalUnsignedShortArray:
2355 __ movzx_w(result, Operand(external_pointer, key, times_2, 0)); 2358 __ movzx_w(result, Operand(external_pointer, key, times_2, 0));
2356 break; 2359 break;
2357 case kExternalIntArray: 2360 case kExternalIntArray:
2358 __ mov(result, Operand(external_pointer, key, times_4, 0)); 2361 __ mov(result, Operand(external_pointer, key, times_4, 0));
2359 break; 2362 break;
2360 case kExternalUnsignedIntArray: 2363 case kExternalUnsignedIntArray:
2361 __ mov(result, Operand(external_pointer, key, times_4, 0)); 2364 __ mov(result, Operand(external_pointer, key, times_4, 0));
2362 __ test(result, Operand(result)); 2365 __ test(result, Operand(result));
2363 // TODO(danno): we could be more clever here, perhaps having a special 2366 // TODO(danno): we could be more clever here, perhaps having a special
2364 // version of the stub that detects if the overflow case actually 2367 // version of the stub that detects if the overflow case actually
2365 // happens, and generate code that returns a double rather than int. 2368 // happens, and generate code that returns a double rather than int.
2366 DeoptimizeIf(negative, instr->environment()); 2369 DeoptimizeIf(negative, instr->environment());
2367 break; 2370 break;
2368 case kExternalFloatArray: 2371 case kExternalFloatArray:
2372 case kExternalDoubleArray:
2369 UNREACHABLE(); 2373 UNREACHABLE();
2370 break; 2374 break;
2371 } 2375 }
2372 } 2376 }
2373 } 2377 }
2374 2378
2375 2379
2376 void LCodeGen::DoLoadKeyedGeneric(LLoadKeyedGeneric* instr) { 2380 void LCodeGen::DoLoadKeyedGeneric(LLoadKeyedGeneric* instr) {
2377 ASSERT(ToRegister(instr->context()).is(esi)); 2381 ASSERT(ToRegister(instr->context()).is(esi));
2378 ASSERT(ToRegister(instr->object()).is(edx)); 2382 ASSERT(ToRegister(instr->object()).is(edx));
(...skipping 661 matching lines...) Expand 10 before | Expand all | Expand 10 after
3040 3044
3041 3045
3042 void LCodeGen::DoStoreKeyedSpecializedArrayElement( 3046 void LCodeGen::DoStoreKeyedSpecializedArrayElement(
3043 LStoreKeyedSpecializedArrayElement* instr) { 3047 LStoreKeyedSpecializedArrayElement* instr) {
3044 Register external_pointer = ToRegister(instr->external_pointer()); 3048 Register external_pointer = ToRegister(instr->external_pointer());
3045 Register key = ToRegister(instr->key()); 3049 Register key = ToRegister(instr->key());
3046 ExternalArrayType array_type = instr->array_type(); 3050 ExternalArrayType array_type = instr->array_type();
3047 if (array_type == kExternalFloatArray) { 3051 if (array_type == kExternalFloatArray) {
3048 __ cvtsd2ss(xmm0, ToDoubleRegister(instr->value())); 3052 __ cvtsd2ss(xmm0, ToDoubleRegister(instr->value()));
3049 __ movss(Operand(external_pointer, key, times_4, 0), xmm0); 3053 __ movss(Operand(external_pointer, key, times_4, 0), xmm0);
3054 } else if (array_type == kExternalDoubleArray) {
3055 __ movdbl(Operand(external_pointer, key, times_8, 0),
3056 ToDoubleRegister(instr->value()));
3050 } else { 3057 } else {
3051 Register value = ToRegister(instr->value()); 3058 Register value = ToRegister(instr->value());
3052 switch (array_type) { 3059 switch (array_type) {
3053 case kExternalPixelArray: { 3060 case kExternalPixelArray: {
3054 // Clamp the value to [0..255]. 3061 // Clamp the value to [0..255].
3055 Register temp = ToRegister(instr->TempAt(0)); 3062 Register temp = ToRegister(instr->TempAt(0));
3056 // The dec_b below requires that the clamped value is in a byte 3063 // The dec_b below requires that the clamped value is in a byte
3057 // register. eax is an arbitrary choice to satisfy this requirement, we 3064 // register. eax is an arbitrary choice to satisfy this requirement, we
3058 // hinted the register allocator to give us eax when building the 3065 // hinted the register allocator to give us eax when building the
3059 // instruction. 3066 // instruction.
(...skipping 14 matching lines...) Expand all
3074 break; 3081 break;
3075 case kExternalShortArray: 3082 case kExternalShortArray:
3076 case kExternalUnsignedShortArray: 3083 case kExternalUnsignedShortArray:
3077 __ mov_w(Operand(external_pointer, key, times_2, 0), value); 3084 __ mov_w(Operand(external_pointer, key, times_2, 0), value);
3078 break; 3085 break;
3079 case kExternalIntArray: 3086 case kExternalIntArray:
3080 case kExternalUnsignedIntArray: 3087 case kExternalUnsignedIntArray:
3081 __ mov(Operand(external_pointer, key, times_4, 0), value); 3088 __ mov(Operand(external_pointer, key, times_4, 0), value);
3082 break; 3089 break;
3083 case kExternalFloatArray: 3090 case kExternalFloatArray:
3091 case kExternalDoubleArray:
3084 UNREACHABLE(); 3092 UNREACHABLE();
3085 break; 3093 break;
3086 } 3094 }
3087 } 3095 }
3088 } 3096 }
3089 3097
3090 3098
3091 void LCodeGen::DoStoreKeyedFastElement(LStoreKeyedFastElement* instr) { 3099 void LCodeGen::DoStoreKeyedFastElement(LStoreKeyedFastElement* instr) {
3092 Register value = ToRegister(instr->value()); 3100 Register value = ToRegister(instr->value());
3093 Register elements = ToRegister(instr->object()); 3101 Register elements = ToRegister(instr->object());
(...skipping 1109 matching lines...) Expand 10 before | Expand all | Expand 10 after
4203 4211
4204 // If the environment were already registered, we would have no way of 4212 // If the environment were already registered, we would have no way of
4205 // backpatching it with the spill slot operands. 4213 // backpatching it with the spill slot operands.
4206 ASSERT(!environment->HasBeenRegistered()); 4214 ASSERT(!environment->HasBeenRegistered());
4207 RegisterEnvironmentForDeoptimization(environment); 4215 RegisterEnvironmentForDeoptimization(environment);
4208 ASSERT(osr_pc_offset_ == -1); 4216 ASSERT(osr_pc_offset_ == -1);
4209 osr_pc_offset_ = masm()->pc_offset(); 4217 osr_pc_offset_ = masm()->pc_offset();
4210 } 4218 }
4211 4219
4212 4220
4221 void LCodeGen::DoIn(LIn* instr) {
4222 LOperand* obj = instr->object();
4223 LOperand* key = instr->key();
4224 if (key->IsConstantOperand()) {
4225 __ push(ToImmediate(key));
4226 } else {
4227 __ push(ToOperand(key));
4228 }
4229 if (obj->IsConstantOperand()) {
4230 __ push(ToImmediate(obj));
4231 } else {
4232 __ push(ToOperand(obj));
4233 }
4234 ASSERT(instr->HasPointerMap() && instr->HasDeoptimizationEnvironment());
4235 LPointerMap* pointers = instr->pointer_map();
4236 LEnvironment* env = instr->deoptimization_environment();
4237 RecordPosition(pointers->position());
4238 RegisterEnvironmentForDeoptimization(env);
4239 // Create safepoint generator that will also ensure enough space in the
4240 // reloc info for patching in deoptimization (since this is invoking a
4241 // builtin)
4242 SafepointGenerator safepoint_generator(this,
4243 pointers,
4244 env->deoptimization_index());
4245 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset));
4246 __ InvokeBuiltin(Builtins::IN, CALL_FUNCTION, &safepoint_generator);
4247 }
4248
4249
4213 #undef __ 4250 #undef __
4214 4251
4215 } } // namespace v8::internal 4252 } } // namespace v8::internal
4216 4253
4217 #endif // V8_TARGET_ARCH_IA32 4254 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/hydrogen-instructions.cc ('k') | src/ia32/lithium-ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698