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

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

Issue 20843012: Extract hardcoded error strings into a single place and replace them with enum. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: styles fixed Created 7 years, 4 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
OLDNEW
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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 code->set_stack_slots(GetStackSlotCount()); 84 code->set_stack_slots(GetStackSlotCount());
85 code->set_safepoint_table_offset(safepoints_.GetCodeOffset()); 85 code->set_safepoint_table_offset(safepoints_.GetCodeOffset());
86 if (FLAG_weak_embedded_maps_in_optimized_code) { 86 if (FLAG_weak_embedded_maps_in_optimized_code) {
87 RegisterDependentCodeForEmbeddedMaps(code); 87 RegisterDependentCodeForEmbeddedMaps(code);
88 } 88 }
89 PopulateDeoptimizationData(code); 89 PopulateDeoptimizationData(code);
90 info()->CommitDependencies(code); 90 info()->CommitDependencies(code);
91 } 91 }
92 92
93 93
94 void LCodeGen::Abort(const char* reason) { 94 void LCodeGen::Abort(BailoutReason reason) {
95 info()->set_bailout_reason(reason); 95 info()->set_bailout_reason(reason);
96 status_ = ABORTED; 96 status_ = ABORTED;
97 } 97 }
98 98
99 99
100 void LCodeGen::Comment(const char* format, ...) { 100 void LCodeGen::Comment(const char* format, ...) {
101 if (!FLAG_code_comments) return; 101 if (!FLAG_code_comments) return;
102 char buffer[4 * KB]; 102 char buffer[4 * KB];
103 StringBuilder builder(buffer, ARRAY_SIZE(buffer)); 103 StringBuilder builder(buffer, ARRAY_SIZE(buffer));
104 va_list arguments; 104 va_list arguments;
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 bool LCodeGen::GenerateDeoptJumpTable() { 327 bool LCodeGen::GenerateDeoptJumpTable() {
328 // Check that the jump table is accessible from everywhere in the function 328 // Check that the jump table is accessible from everywhere in the function
329 // code, i.e. that offsets to the table can be encoded in the 24bit signed 329 // code, i.e. that offsets to the table can be encoded in the 24bit signed
330 // immediate of a branch instruction. 330 // immediate of a branch instruction.
331 // To simplify we consider the code size from the first instruction to the 331 // To simplify we consider the code size from the first instruction to the
332 // end of the jump table. We also don't consider the pc load delta. 332 // end of the jump table. We also don't consider the pc load delta.
333 // Each entry in the jump table generates one instruction and inlines one 333 // Each entry in the jump table generates one instruction and inlines one
334 // 32bit data after it. 334 // 32bit data after it.
335 if (!is_int24((masm()->pc_offset() / Assembler::kInstrSize) + 335 if (!is_int24((masm()->pc_offset() / Assembler::kInstrSize) +
336 deopt_jump_table_.length() * 7)) { 336 deopt_jump_table_.length() * 7)) {
337 Abort("Generated code is too large"); 337 Abort(kGeneratedCodeIsTooLarge);
338 } 338 }
339 339
340 if (deopt_jump_table_.length() > 0) { 340 if (deopt_jump_table_.length() > 0) {
341 Comment(";;; -------------------- Jump table --------------------"); 341 Comment(";;; -------------------- Jump table --------------------");
342 } 342 }
343 Label table_start; 343 Label table_start;
344 __ bind(&table_start); 344 __ bind(&table_start);
345 Label needs_frame; 345 Label needs_frame;
346 for (int i = 0; i < deopt_jump_table_.length(); i++) { 346 for (int i = 0; i < deopt_jump_table_.length(); i++) {
347 __ bind(&deopt_jump_table_[i].label); 347 __ bind(&deopt_jump_table_[i].label);
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 return ToRegister(op->index()); 416 return ToRegister(op->index());
417 } else if (op->IsConstantOperand()) { 417 } else if (op->IsConstantOperand()) {
418 LConstantOperand* const_op = LConstantOperand::cast(op); 418 LConstantOperand* const_op = LConstantOperand::cast(op);
419 HConstant* constant = chunk_->LookupConstant(const_op); 419 HConstant* constant = chunk_->LookupConstant(const_op);
420 Handle<Object> literal = constant->handle(); 420 Handle<Object> literal = constant->handle();
421 Representation r = chunk_->LookupLiteralRepresentation(const_op); 421 Representation r = chunk_->LookupLiteralRepresentation(const_op);
422 if (r.IsInteger32()) { 422 if (r.IsInteger32()) {
423 ASSERT(literal->IsNumber()); 423 ASSERT(literal->IsNumber());
424 __ mov(scratch, Operand(static_cast<int32_t>(literal->Number()))); 424 __ mov(scratch, Operand(static_cast<int32_t>(literal->Number())));
425 } else if (r.IsDouble()) { 425 } else if (r.IsDouble()) {
426 Abort("EmitLoadRegister: Unsupported double immediate."); 426 Abort(kEmitLoadRegisterUnsupportedDoubleImmediate);
427 } else { 427 } else {
428 ASSERT(r.IsTagged()); 428 ASSERT(r.IsTagged());
429 __ LoadObject(scratch, literal); 429 __ LoadObject(scratch, literal);
430 } 430 }
431 return scratch; 431 return scratch;
432 } else if (op->IsStackSlot() || op->IsArgument()) { 432 } else if (op->IsStackSlot() || op->IsArgument()) {
433 __ ldr(scratch, ToMemOperand(op)); 433 __ ldr(scratch, ToMemOperand(op));
434 return scratch; 434 return scratch;
435 } 435 }
436 UNREACHABLE(); 436 UNREACHABLE();
(...skipping 17 matching lines...) Expand all
454 HConstant* constant = chunk_->LookupConstant(const_op); 454 HConstant* constant = chunk_->LookupConstant(const_op);
455 Handle<Object> literal = constant->handle(); 455 Handle<Object> literal = constant->handle();
456 Representation r = chunk_->LookupLiteralRepresentation(const_op); 456 Representation r = chunk_->LookupLiteralRepresentation(const_op);
457 if (r.IsInteger32()) { 457 if (r.IsInteger32()) {
458 ASSERT(literal->IsNumber()); 458 ASSERT(literal->IsNumber());
459 __ mov(ip, Operand(static_cast<int32_t>(literal->Number()))); 459 __ mov(ip, Operand(static_cast<int32_t>(literal->Number())));
460 __ vmov(flt_scratch, ip); 460 __ vmov(flt_scratch, ip);
461 __ vcvt_f64_s32(dbl_scratch, flt_scratch); 461 __ vcvt_f64_s32(dbl_scratch, flt_scratch);
462 return dbl_scratch; 462 return dbl_scratch;
463 } else if (r.IsDouble()) { 463 } else if (r.IsDouble()) {
464 Abort("unsupported double immediate"); 464 Abort(kUnsupportedDoubleImmediate);
465 } else if (r.IsTagged()) { 465 } else if (r.IsTagged()) {
466 Abort("unsupported tagged immediate"); 466 Abort(kUnsupportedTaggedImmediate);
467 } 467 }
468 } else if (op->IsStackSlot() || op->IsArgument()) { 468 } else if (op->IsStackSlot() || op->IsArgument()) {
469 // TODO(regis): Why is vldr not taking a MemOperand? 469 // TODO(regis): Why is vldr not taking a MemOperand?
470 // __ vldr(dbl_scratch, ToMemOperand(op)); 470 // __ vldr(dbl_scratch, ToMemOperand(op));
471 MemOperand mem_op = ToMemOperand(op); 471 MemOperand mem_op = ToMemOperand(op);
472 __ vldr(dbl_scratch, mem_op.rn(), mem_op.offset()); 472 __ vldr(dbl_scratch, mem_op.rn(), mem_op.offset());
473 return dbl_scratch; 473 return dbl_scratch;
474 } 474 }
475 UNREACHABLE(); 475 UNREACHABLE();
476 return dbl_scratch; 476 return dbl_scratch;
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
527 LConstantOperand* const_op = LConstantOperand::cast(op); 527 LConstantOperand* const_op = LConstantOperand::cast(op);
528 HConstant* constant = chunk()->LookupConstant(const_op); 528 HConstant* constant = chunk()->LookupConstant(const_op);
529 Representation r = chunk_->LookupLiteralRepresentation(const_op); 529 Representation r = chunk_->LookupLiteralRepresentation(const_op);
530 if (r.IsSmi()) { 530 if (r.IsSmi()) {
531 ASSERT(constant->HasSmiValue()); 531 ASSERT(constant->HasSmiValue());
532 return Operand(Smi::FromInt(constant->Integer32Value())); 532 return Operand(Smi::FromInt(constant->Integer32Value()));
533 } else if (r.IsInteger32()) { 533 } else if (r.IsInteger32()) {
534 ASSERT(constant->HasInteger32Value()); 534 ASSERT(constant->HasInteger32Value());
535 return Operand(constant->Integer32Value()); 535 return Operand(constant->Integer32Value());
536 } else if (r.IsDouble()) { 536 } else if (r.IsDouble()) {
537 Abort("ToOperand Unsupported double immediate."); 537 Abort(kToOperandUnsupportedDoubleImmediate);
538 } 538 }
539 ASSERT(r.IsTagged()); 539 ASSERT(r.IsTagged());
540 return Operand(constant->handle()); 540 return Operand(constant->handle());
541 } else if (op->IsRegister()) { 541 } else if (op->IsRegister()) {
542 return Operand(ToRegister(op)); 542 return Operand(ToRegister(op));
543 } else if (op->IsDoubleRegister()) { 543 } else if (op->IsDoubleRegister()) {
544 Abort("ToOperand IsDoubleRegister unimplemented"); 544 Abort(kToOperandIsDoubleRegisterUnimplemented);
545 return Operand::Zero(); 545 return Operand::Zero();
546 } 546 }
547 // Stack slots not implemented, use ToMemOperand instead. 547 // Stack slots not implemented, use ToMemOperand instead.
548 UNREACHABLE(); 548 UNREACHABLE();
549 return Operand::Zero(); 549 return Operand::Zero();
550 } 550 }
551 551
552 552
553 MemOperand LCodeGen::ToMemOperand(LOperand* op) const { 553 MemOperand LCodeGen::ToMemOperand(LOperand* op) const {
554 ASSERT(!op->IsRegister()); 554 ASSERT(!op->IsRegister());
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
765 void LCodeGen::DeoptimizeIf(Condition cc, 765 void LCodeGen::DeoptimizeIf(Condition cc,
766 LEnvironment* environment, 766 LEnvironment* environment,
767 Deoptimizer::BailoutType bailout_type) { 767 Deoptimizer::BailoutType bailout_type) {
768 RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt); 768 RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt);
769 ASSERT(environment->HasBeenRegistered()); 769 ASSERT(environment->HasBeenRegistered());
770 int id = environment->deoptimization_index(); 770 int id = environment->deoptimization_index();
771 ASSERT(info()->IsOptimizing() || info()->IsStub()); 771 ASSERT(info()->IsOptimizing() || info()->IsStub());
772 Address entry = 772 Address entry =
773 Deoptimizer::GetDeoptimizationEntry(isolate(), id, bailout_type); 773 Deoptimizer::GetDeoptimizationEntry(isolate(), id, bailout_type);
774 if (entry == NULL) { 774 if (entry == NULL) {
775 Abort("bailout was not prepared"); 775 Abort(kBailoutWasNotPrepared);
776 return; 776 return;
777 } 777 }
778 778
779 ASSERT(FLAG_deopt_every_n_times < 2); // Other values not supported on ARM. 779 ASSERT(FLAG_deopt_every_n_times < 2); // Other values not supported on ARM.
780 if (FLAG_deopt_every_n_times == 1 && 780 if (FLAG_deopt_every_n_times == 1 &&
781 !info()->IsStub() && 781 !info()->IsStub() &&
782 info()->opt_count() == id) { 782 info()->opt_count() == id) {
783 ASSERT(frame_is_built_); 783 ASSERT(frame_is_built_);
784 __ Call(entry, RelocInfo::RUNTIME_ENTRY); 784 __ Call(entry, RelocInfo::RUNTIME_ENTRY);
785 return; 785 return;
(...skipping 1143 matching lines...) Expand 10 before | Expand all | Expand 10 after
1929 1929
1930 if (FLAG_debug_code) { 1930 if (FLAG_debug_code) {
1931 __ ldr(ip, FieldMemOperand(string, HeapObject::kMapOffset)); 1931 __ ldr(ip, FieldMemOperand(string, HeapObject::kMapOffset));
1932 __ ldrb(ip, FieldMemOperand(ip, Map::kInstanceTypeOffset)); 1932 __ ldrb(ip, FieldMemOperand(ip, Map::kInstanceTypeOffset));
1933 1933
1934 __ and_(ip, ip, Operand(kStringRepresentationMask | kStringEncodingMask)); 1934 __ and_(ip, ip, Operand(kStringRepresentationMask | kStringEncodingMask));
1935 static const uint32_t one_byte_seq_type = kSeqStringTag | kOneByteStringTag; 1935 static const uint32_t one_byte_seq_type = kSeqStringTag | kOneByteStringTag;
1936 static const uint32_t two_byte_seq_type = kSeqStringTag | kTwoByteStringTag; 1936 static const uint32_t two_byte_seq_type = kSeqStringTag | kTwoByteStringTag;
1937 __ cmp(ip, Operand(encoding == String::ONE_BYTE_ENCODING 1937 __ cmp(ip, Operand(encoding == String::ONE_BYTE_ENCODING
1938 ? one_byte_seq_type : two_byte_seq_type)); 1938 ? one_byte_seq_type : two_byte_seq_type));
1939 __ Check(eq, "Unexpected string type"); 1939 __ Check(eq, kUnexpectedStringType);
1940 } 1940 }
1941 1941
1942 __ add(ip, 1942 __ add(ip,
1943 string, 1943 string,
1944 Operand(SeqString::kHeaderSize - kHeapObjectTag)); 1944 Operand(SeqString::kHeaderSize - kHeapObjectTag));
1945 if (encoding == String::ONE_BYTE_ENCODING) { 1945 if (encoding == String::ONE_BYTE_ENCODING) {
1946 __ strb(value, MemOperand(ip, index)); 1946 __ strb(value, MemOperand(ip, index));
1947 } else { 1947 } else {
1948 // MemOperand with ip as the base register is not allowed for strh, so 1948 // MemOperand with ip as the base register is not allowed for strh, so
1949 // we do the address calculation explicitly. 1949 // we do the address calculation explicitly.
(...skipping 1243 matching lines...) Expand 10 before | Expand all | Expand 10 after
3193 3193
3194 void LCodeGen::DoLoadKeyedExternalArray(LLoadKeyed* instr) { 3194 void LCodeGen::DoLoadKeyedExternalArray(LLoadKeyed* instr) {
3195 Register external_pointer = ToRegister(instr->elements()); 3195 Register external_pointer = ToRegister(instr->elements());
3196 Register key = no_reg; 3196 Register key = no_reg;
3197 ElementsKind elements_kind = instr->elements_kind(); 3197 ElementsKind elements_kind = instr->elements_kind();
3198 bool key_is_constant = instr->key()->IsConstantOperand(); 3198 bool key_is_constant = instr->key()->IsConstantOperand();
3199 int constant_key = 0; 3199 int constant_key = 0;
3200 if (key_is_constant) { 3200 if (key_is_constant) {
3201 constant_key = ToInteger32(LConstantOperand::cast(instr->key())); 3201 constant_key = ToInteger32(LConstantOperand::cast(instr->key()));
3202 if (constant_key & 0xF0000000) { 3202 if (constant_key & 0xF0000000) {
3203 Abort("array index constant value too big."); 3203 Abort(kArrayIndexConstantValueTooBig);
3204 } 3204 }
3205 } else { 3205 } else {
3206 key = ToRegister(instr->key()); 3206 key = ToRegister(instr->key());
3207 } 3207 }
3208 int element_size_shift = ElementsKindToShiftSize(elements_kind); 3208 int element_size_shift = ElementsKindToShiftSize(elements_kind);
3209 int shift_size = (instr->hydrogen()->key()->representation().IsSmi()) 3209 int shift_size = (instr->hydrogen()->key()->representation().IsSmi())
3210 ? (element_size_shift - kSmiTagSize) : element_size_shift; 3210 ? (element_size_shift - kSmiTagSize) : element_size_shift;
3211 int additional_offset = instr->additional_index() << element_size_shift; 3211 int additional_offset = instr->additional_index() << element_size_shift;
3212 3212
3213 if (elements_kind == EXTERNAL_FLOAT_ELEMENTS || 3213 if (elements_kind == EXTERNAL_FLOAT_ELEMENTS ||
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
3277 DwVfpRegister result = ToDoubleRegister(instr->result()); 3277 DwVfpRegister result = ToDoubleRegister(instr->result());
3278 Register scratch = scratch0(); 3278 Register scratch = scratch0();
3279 3279
3280 int element_size_shift = ElementsKindToShiftSize(FAST_DOUBLE_ELEMENTS); 3280 int element_size_shift = ElementsKindToShiftSize(FAST_DOUBLE_ELEMENTS);
3281 int shift_size = (instr->hydrogen()->key()->representation().IsSmi()) 3281 int shift_size = (instr->hydrogen()->key()->representation().IsSmi())
3282 ? (element_size_shift - kSmiTagSize) : element_size_shift; 3282 ? (element_size_shift - kSmiTagSize) : element_size_shift;
3283 int constant_key = 0; 3283 int constant_key = 0;
3284 if (key_is_constant) { 3284 if (key_is_constant) {
3285 constant_key = ToInteger32(LConstantOperand::cast(instr->key())); 3285 constant_key = ToInteger32(LConstantOperand::cast(instr->key()));
3286 if (constant_key & 0xF0000000) { 3286 if (constant_key & 0xF0000000) {
3287 Abort("array index constant value too big."); 3287 Abort(kArrayIndexConstantValueTooBig);
3288 } 3288 }
3289 } else { 3289 } else {
3290 key = ToRegister(instr->key()); 3290 key = ToRegister(instr->key());
3291 } 3291 }
3292 3292
3293 int base_offset = (FixedDoubleArray::kHeaderSize - kHeapObjectTag) + 3293 int base_offset = (FixedDoubleArray::kHeaderSize - kHeapObjectTag) +
3294 ((constant_key + instr->additional_index()) << element_size_shift); 3294 ((constant_key + instr->additional_index()) << element_size_shift);
3295 if (!key_is_constant) { 3295 if (!key_is_constant) {
3296 __ add(elements, elements, Operand(key, LSL, shift_size)); 3296 __ add(elements, elements, Operand(key, LSL, shift_size));
3297 } 3297 }
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
3538 ParameterCount actual(receiver); 3538 ParameterCount actual(receiver);
3539 __ InvokeFunction(function, actual, CALL_FUNCTION, 3539 __ InvokeFunction(function, actual, CALL_FUNCTION,
3540 safepoint_generator, CALL_AS_METHOD); 3540 safepoint_generator, CALL_AS_METHOD);
3541 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); 3541 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
3542 } 3542 }
3543 3543
3544 3544
3545 void LCodeGen::DoPushArgument(LPushArgument* instr) { 3545 void LCodeGen::DoPushArgument(LPushArgument* instr) {
3546 LOperand* argument = instr->value(); 3546 LOperand* argument = instr->value();
3547 if (argument->IsDoubleRegister() || argument->IsDoubleStackSlot()) { 3547 if (argument->IsDoubleRegister() || argument->IsDoubleStackSlot()) {
3548 Abort("DoPushArgument not implemented for double type."); 3548 Abort(kDoPushArgumentNotImplementedForDoubleType);
3549 } else { 3549 } else {
3550 Register argument_reg = EmitLoadRegister(argument, ip); 3550 Register argument_reg = EmitLoadRegister(argument, ip);
3551 __ push(argument_reg); 3551 __ push(argument_reg);
3552 } 3552 }
3553 } 3553 }
3554 3554
3555 3555
3556 void LCodeGen::DoDrop(LDrop* instr) { 3556 void LCodeGen::DoDrop(LDrop* instr) {
3557 __ Drop(instr->count()); 3557 __ Drop(instr->count());
3558 } 3558 }
(...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after
4312 4312
4313 void LCodeGen::DoStoreKeyedExternalArray(LStoreKeyed* instr) { 4313 void LCodeGen::DoStoreKeyedExternalArray(LStoreKeyed* instr) {
4314 Register external_pointer = ToRegister(instr->elements()); 4314 Register external_pointer = ToRegister(instr->elements());
4315 Register key = no_reg; 4315 Register key = no_reg;
4316 ElementsKind elements_kind = instr->elements_kind(); 4316 ElementsKind elements_kind = instr->elements_kind();
4317 bool key_is_constant = instr->key()->IsConstantOperand(); 4317 bool key_is_constant = instr->key()->IsConstantOperand();
4318 int constant_key = 0; 4318 int constant_key = 0;
4319 if (key_is_constant) { 4319 if (key_is_constant) {
4320 constant_key = ToInteger32(LConstantOperand::cast(instr->key())); 4320 constant_key = ToInteger32(LConstantOperand::cast(instr->key()));
4321 if (constant_key & 0xF0000000) { 4321 if (constant_key & 0xF0000000) {
4322 Abort("array index constant value too big."); 4322 Abort(kArrayIndexConstantValueTooBig);
4323 } 4323 }
4324 } else { 4324 } else {
4325 key = ToRegister(instr->key()); 4325 key = ToRegister(instr->key());
4326 } 4326 }
4327 int element_size_shift = ElementsKindToShiftSize(elements_kind); 4327 int element_size_shift = ElementsKindToShiftSize(elements_kind);
4328 int shift_size = (instr->hydrogen()->key()->representation().IsSmi()) 4328 int shift_size = (instr->hydrogen()->key()->representation().IsSmi())
4329 ? (element_size_shift - kSmiTagSize) : element_size_shift; 4329 ? (element_size_shift - kSmiTagSize) : element_size_shift;
4330 int additional_offset = instr->additional_index() << element_size_shift; 4330 int additional_offset = instr->additional_index() << element_size_shift;
4331 4331
4332 if (elements_kind == EXTERNAL_FLOAT_ELEMENTS || 4332 if (elements_kind == EXTERNAL_FLOAT_ELEMENTS ||
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
4385 Register key = no_reg; 4385 Register key = no_reg;
4386 Register scratch = scratch0(); 4386 Register scratch = scratch0();
4387 bool key_is_constant = instr->key()->IsConstantOperand(); 4387 bool key_is_constant = instr->key()->IsConstantOperand();
4388 int constant_key = 0; 4388 int constant_key = 0;
4389 4389
4390 // Calculate the effective address of the slot in the array to store the 4390 // Calculate the effective address of the slot in the array to store the
4391 // double value. 4391 // double value.
4392 if (key_is_constant) { 4392 if (key_is_constant) {
4393 constant_key = ToInteger32(LConstantOperand::cast(instr->key())); 4393 constant_key = ToInteger32(LConstantOperand::cast(instr->key()));
4394 if (constant_key & 0xF0000000) { 4394 if (constant_key & 0xF0000000) {
4395 Abort("array index constant value too big."); 4395 Abort(kArrayIndexConstantValueTooBig);
4396 } 4396 }
4397 } else { 4397 } else {
4398 key = ToRegister(instr->key()); 4398 key = ToRegister(instr->key());
4399 } 4399 }
4400 int element_size_shift = ElementsKindToShiftSize(FAST_DOUBLE_ELEMENTS); 4400 int element_size_shift = ElementsKindToShiftSize(FAST_DOUBLE_ELEMENTS);
4401 int shift_size = (instr->hydrogen()->key()->representation().IsSmi()) 4401 int shift_size = (instr->hydrogen()->key()->representation().IsSmi())
4402 ? (element_size_shift - kSmiTagSize) : element_size_shift; 4402 ? (element_size_shift - kSmiTagSize) : element_size_shift;
4403 Operand operand = key_is_constant 4403 Operand operand = key_is_constant
4404 ? Operand((constant_key << element_size_shift) + 4404 ? Operand((constant_key << element_size_shift) +
4405 FixedDoubleArray::kHeaderSize - kHeapObjectTag) 4405 FixedDoubleArray::kHeaderSize - kHeapObjectTag)
4406 : Operand(key, LSL, shift_size); 4406 : Operand(key, LSL, shift_size);
4407 __ add(scratch, elements, operand); 4407 __ add(scratch, elements, operand);
4408 if (!key_is_constant) { 4408 if (!key_is_constant) {
4409 __ add(scratch, scratch, 4409 __ add(scratch, scratch,
4410 Operand(FixedDoubleArray::kHeaderSize - kHeapObjectTag)); 4410 Operand(FixedDoubleArray::kHeaderSize - kHeapObjectTag));
4411 } 4411 }
4412 4412
4413 if (instr->NeedsCanonicalization()) { 4413 if (instr->NeedsCanonicalization()) {
4414 // Force a canonical NaN. 4414 // Force a canonical NaN.
4415 if (masm()->emit_debug_code()) { 4415 if (masm()->emit_debug_code()) {
4416 __ vmrs(ip); 4416 __ vmrs(ip);
4417 __ tst(ip, Operand(kVFPDefaultNaNModeControlBit)); 4417 __ tst(ip, Operand(kVFPDefaultNaNModeControlBit));
4418 __ Assert(ne, "Default NaN mode not set"); 4418 __ Assert(ne, kDefaultNaNModeNotSet);
4419 } 4419 }
4420 __ VFPCanonicalizeNaN(value); 4420 __ VFPCanonicalizeNaN(value);
4421 } 4421 }
4422 __ vstr(value, scratch, instr->additional_index() << element_size_shift); 4422 __ vstr(value, scratch, instr->additional_index() << element_size_shift);
4423 } 4423 }
4424 4424
4425 4425
4426 void LCodeGen::DoStoreKeyedFixedArray(LStoreKeyed* instr) { 4426 void LCodeGen::DoStoreKeyedFixedArray(LStoreKeyed* instr) {
4427 Register value = ToRegister(instr->value()); 4427 Register value = ToRegister(instr->value());
4428 Register elements = ToRegister(instr->elements()); 4428 Register elements = ToRegister(instr->elements());
(...skipping 1395 matching lines...) Expand 10 before | Expand all | Expand 10 after
5824 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index)); 5824 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index));
5825 __ ldr(result, FieldMemOperand(scratch, 5825 __ ldr(result, FieldMemOperand(scratch,
5826 FixedArray::kHeaderSize - kPointerSize)); 5826 FixedArray::kHeaderSize - kPointerSize));
5827 __ bind(&done); 5827 __ bind(&done);
5828 } 5828 }
5829 5829
5830 5830
5831 #undef __ 5831 #undef __
5832 5832
5833 } } // namespace v8::internal 5833 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/lithium-codegen-arm.h ('k') | src/arm/macro-assembler-arm.h » ('j') | src/compiler.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698