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

Side by Side Diff: src/arm/lithium-codegen-arm.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/arm/lithium-arm.cc ('k') | src/arm/stub-cache-arm.cc » ('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 2461 matching lines...) Expand 10 before | Expand all | Expand 10 after
2472 LLoadKeyedSpecializedArrayElement* instr) { 2472 LLoadKeyedSpecializedArrayElement* instr) {
2473 Register external_pointer = ToRegister(instr->external_pointer()); 2473 Register external_pointer = ToRegister(instr->external_pointer());
2474 Register key = ToRegister(instr->key()); 2474 Register key = ToRegister(instr->key());
2475 ExternalArrayType array_type = instr->array_type(); 2475 ExternalArrayType array_type = instr->array_type();
2476 if (array_type == kExternalFloatArray) { 2476 if (array_type == kExternalFloatArray) {
2477 CpuFeatures::Scope scope(VFP3); 2477 CpuFeatures::Scope scope(VFP3);
2478 DwVfpRegister result(ToDoubleRegister(instr->result())); 2478 DwVfpRegister result(ToDoubleRegister(instr->result()));
2479 __ add(scratch0(), external_pointer, Operand(key, LSL, 2)); 2479 __ add(scratch0(), external_pointer, Operand(key, LSL, 2));
2480 __ vldr(result.low(), scratch0(), 0); 2480 __ vldr(result.low(), scratch0(), 0);
2481 __ vcvt_f64_f32(result, result.low()); 2481 __ vcvt_f64_f32(result, result.low());
2482 } else if (array_type == kExternalDoubleArray) {
2483 CpuFeatures::Scope scope(VFP3);
2484 DwVfpRegister result(ToDoubleRegister(instr->result()));
2485 __ add(scratch0(), external_pointer, Operand(key, LSL, 3));
2486 __ vldr(result, scratch0(), 0);
2482 } else { 2487 } else {
2483 Register result(ToRegister(instr->result())); 2488 Register result(ToRegister(instr->result()));
2484 switch (array_type) { 2489 switch (array_type) {
2485 case kExternalByteArray: 2490 case kExternalByteArray:
2486 __ ldrsb(result, MemOperand(external_pointer, key)); 2491 __ ldrsb(result, MemOperand(external_pointer, key));
2487 break; 2492 break;
2488 case kExternalUnsignedByteArray: 2493 case kExternalUnsignedByteArray:
2489 case kExternalPixelArray: 2494 case kExternalPixelArray:
2490 __ ldrb(result, MemOperand(external_pointer, key)); 2495 __ ldrb(result, MemOperand(external_pointer, key));
2491 break; 2496 break;
2492 case kExternalShortArray: 2497 case kExternalShortArray:
2493 __ ldrsh(result, MemOperand(external_pointer, key, LSL, 1)); 2498 __ ldrsh(result, MemOperand(external_pointer, key, LSL, 1));
2494 break; 2499 break;
2495 case kExternalUnsignedShortArray: 2500 case kExternalUnsignedShortArray:
2496 __ ldrh(result, MemOperand(external_pointer, key, LSL, 1)); 2501 __ ldrh(result, MemOperand(external_pointer, key, LSL, 1));
2497 break; 2502 break;
2498 case kExternalIntArray: 2503 case kExternalIntArray:
2499 __ ldr(result, MemOperand(external_pointer, key, LSL, 2)); 2504 __ ldr(result, MemOperand(external_pointer, key, LSL, 2));
2500 break; 2505 break;
2501 case kExternalUnsignedIntArray: 2506 case kExternalUnsignedIntArray:
2502 __ ldr(result, MemOperand(external_pointer, key, LSL, 2)); 2507 __ ldr(result, MemOperand(external_pointer, key, LSL, 2));
2503 __ cmp(result, Operand(0x80000000)); 2508 __ cmp(result, Operand(0x80000000));
2504 // TODO(danno): we could be more clever here, perhaps having a special 2509 // TODO(danno): we could be more clever here, perhaps having a special
2505 // version of the stub that detects if the overflow case actually 2510 // version of the stub that detects if the overflow case actually
2506 // happens, and generate code that returns a double rather than int. 2511 // happens, and generate code that returns a double rather than int.
2507 DeoptimizeIf(cs, instr->environment()); 2512 DeoptimizeIf(cs, instr->environment());
2508 break; 2513 break;
2509 case kExternalFloatArray: 2514 case kExternalFloatArray:
2515 case kExternalDoubleArray:
2510 UNREACHABLE(); 2516 UNREACHABLE();
2511 break; 2517 break;
2512 } 2518 }
2513 } 2519 }
2514 } 2520 }
2515 2521
2516 2522
2517 void LCodeGen::DoLoadKeyedGeneric(LLoadKeyedGeneric* instr) { 2523 void LCodeGen::DoLoadKeyedGeneric(LLoadKeyedGeneric* instr) {
2518 ASSERT(ToRegister(instr->object()).is(r1)); 2524 ASSERT(ToRegister(instr->object()).is(r1));
2519 ASSERT(ToRegister(instr->key()).is(r0)); 2525 ASSERT(ToRegister(instr->key()).is(r0));
(...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after
3225 } 3231 }
3226 } 3232 }
3227 3233
3228 3234
3229 void LCodeGen::DoStoreKeyedSpecializedArrayElement( 3235 void LCodeGen::DoStoreKeyedSpecializedArrayElement(
3230 LStoreKeyedSpecializedArrayElement* instr) { 3236 LStoreKeyedSpecializedArrayElement* instr) {
3231 3237
3232 Register external_pointer = ToRegister(instr->external_pointer()); 3238 Register external_pointer = ToRegister(instr->external_pointer());
3233 Register key = ToRegister(instr->key()); 3239 Register key = ToRegister(instr->key());
3234 ExternalArrayType array_type = instr->array_type(); 3240 ExternalArrayType array_type = instr->array_type();
3241
3235 if (array_type == kExternalFloatArray) { 3242 if (array_type == kExternalFloatArray) {
3236 CpuFeatures::Scope scope(VFP3); 3243 CpuFeatures::Scope scope(VFP3);
3237 DwVfpRegister value(ToDoubleRegister(instr->value())); 3244 DwVfpRegister value(ToDoubleRegister(instr->value()));
3238 __ add(scratch0(), external_pointer, Operand(key, LSL, 2)); 3245 __ add(scratch0(), external_pointer, Operand(key, LSL, 2));
3239 __ vcvt_f32_f64(double_scratch0().low(), value); 3246 __ vcvt_f32_f64(double_scratch0().low(), value);
3240 __ vstr(double_scratch0().low(), scratch0(), 0); 3247 __ vstr(double_scratch0().low(), scratch0(), 0);
3248 } else if (array_type == kExternalDoubleArray) {
3249 CpuFeatures::Scope scope(VFP3);
3250 DwVfpRegister value(ToDoubleRegister(instr->value()));
3251 __ add(scratch0(), external_pointer, Operand(key, LSL, 3));
3252 __ vstr(value, scratch0(), 0);
3241 } else { 3253 } else {
3242 Register value(ToRegister(instr->value())); 3254 Register value(ToRegister(instr->value()));
3243 switch (array_type) { 3255 switch (array_type) {
3244 case kExternalPixelArray: 3256 case kExternalPixelArray:
3245 // Clamp the value to [0..255]. 3257 // Clamp the value to [0..255].
3246 __ Usat(value, 8, Operand(value)); 3258 __ Usat(value, 8, Operand(value));
3247 __ strb(value, MemOperand(external_pointer, key)); 3259 __ strb(value, MemOperand(external_pointer, key));
3248 break; 3260 break;
3249 case kExternalByteArray: 3261 case kExternalByteArray:
3250 case kExternalUnsignedByteArray: 3262 case kExternalUnsignedByteArray:
3251 __ strb(value, MemOperand(external_pointer, key)); 3263 __ strb(value, MemOperand(external_pointer, key));
3252 break; 3264 break;
3253 case kExternalShortArray: 3265 case kExternalShortArray:
3254 case kExternalUnsignedShortArray: 3266 case kExternalUnsignedShortArray:
3255 __ strh(value, MemOperand(external_pointer, key, LSL, 1)); 3267 __ strh(value, MemOperand(external_pointer, key, LSL, 1));
3256 break; 3268 break;
3257 case kExternalIntArray: 3269 case kExternalIntArray:
3258 case kExternalUnsignedIntArray: 3270 case kExternalUnsignedIntArray:
3259 __ str(value, MemOperand(external_pointer, key, LSL, 2)); 3271 __ str(value, MemOperand(external_pointer, key, LSL, 2));
3260 break; 3272 break;
3261 case kExternalFloatArray: 3273 case kExternalFloatArray:
3274 case kExternalDoubleArray:
3262 UNREACHABLE(); 3275 UNREACHABLE();
3263 break; 3276 break;
3264 } 3277 }
3265 } 3278 }
3266 } 3279 }
3267 3280
3268 3281
3269 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) { 3282 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) {
3270 ASSERT(ToRegister(instr->object()).is(r2)); 3283 ASSERT(ToRegister(instr->object()).is(r2));
3271 ASSERT(ToRegister(instr->key()).is(r1)); 3284 ASSERT(ToRegister(instr->key()).is(r1));
(...skipping 965 matching lines...) Expand 10 before | Expand all | Expand 10 after
4237 LEnvironment* env = instr->deoptimization_environment(); 4250 LEnvironment* env = instr->deoptimization_environment();
4238 RecordPosition(pointers->position()); 4251 RecordPosition(pointers->position());
4239 RegisterEnvironmentForDeoptimization(env); 4252 RegisterEnvironmentForDeoptimization(env);
4240 SafepointGenerator safepoint_generator(this, 4253 SafepointGenerator safepoint_generator(this,
4241 pointers, 4254 pointers,
4242 env->deoptimization_index()); 4255 env->deoptimization_index());
4243 __ InvokeBuiltin(Builtins::DELETE, CALL_JS, &safepoint_generator); 4256 __ InvokeBuiltin(Builtins::DELETE, CALL_JS, &safepoint_generator);
4244 } 4257 }
4245 4258
4246 4259
4260 void LCodeGen::DoIn(LIn* instr) {
4261 Register obj = ToRegister(instr->object());
4262 Register key = ToRegister(instr->key());
4263 __ Push(key, obj);
4264 ASSERT(instr->HasPointerMap() && instr->HasDeoptimizationEnvironment());
4265 LPointerMap* pointers = instr->pointer_map();
4266 LEnvironment* env = instr->deoptimization_environment();
4267 RecordPosition(pointers->position());
4268 RegisterEnvironmentForDeoptimization(env);
4269 SafepointGenerator safepoint_generator(this,
4270 pointers,
4271 env->deoptimization_index());
4272 __ InvokeBuiltin(Builtins::IN, CALL_JS, &safepoint_generator);
4273 }
4274
4275
4247 void LCodeGen::DoStackCheck(LStackCheck* instr) { 4276 void LCodeGen::DoStackCheck(LStackCheck* instr) {
4248 // Perform stack overflow check. 4277 // Perform stack overflow check.
4249 Label ok; 4278 Label ok;
4250 __ LoadRoot(ip, Heap::kStackLimitRootIndex); 4279 __ LoadRoot(ip, Heap::kStackLimitRootIndex);
4251 __ cmp(sp, Operand(ip)); 4280 __ cmp(sp, Operand(ip));
4252 __ b(hs, &ok); 4281 __ b(hs, &ok);
4253 StackCheckStub stub; 4282 StackCheckStub stub;
4254 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); 4283 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
4255 __ bind(&ok); 4284 __ bind(&ok);
4256 } 4285 }
4257 4286
4258 4287
4259 void LCodeGen::DoOsrEntry(LOsrEntry* instr) { 4288 void LCodeGen::DoOsrEntry(LOsrEntry* instr) {
4260 // This is a pseudo-instruction that ensures that the environment here is 4289 // This is a pseudo-instruction that ensures that the environment here is
4261 // properly registered for deoptimization and records the assembler's PC 4290 // properly registered for deoptimization and records the assembler's PC
4262 // offset. 4291 // offset.
4263 LEnvironment* environment = instr->environment(); 4292 LEnvironment* environment = instr->environment();
4264 environment->SetSpilledRegisters(instr->SpilledRegisterArray(), 4293 environment->SetSpilledRegisters(instr->SpilledRegisterArray(),
4265 instr->SpilledDoubleRegisterArray()); 4294 instr->SpilledDoubleRegisterArray());
4266 4295
4267 // If the environment were already registered, we would have no way of 4296 // If the environment were already registered, we would have no way of
4268 // backpatching it with the spill slot operands. 4297 // backpatching it with the spill slot operands.
4269 ASSERT(!environment->HasBeenRegistered()); 4298 ASSERT(!environment->HasBeenRegistered());
4270 RegisterEnvironmentForDeoptimization(environment); 4299 RegisterEnvironmentForDeoptimization(environment);
4271 ASSERT(osr_pc_offset_ == -1); 4300 ASSERT(osr_pc_offset_ == -1);
4272 osr_pc_offset_ = masm()->pc_offset(); 4301 osr_pc_offset_ = masm()->pc_offset();
4273 } 4302 }
4274 4303
4275 4304
4305
4306
4276 #undef __ 4307 #undef __
4277 4308
4278 } } // namespace v8::internal 4309 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/lithium-arm.cc ('k') | src/arm/stub-cache-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698