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

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

Issue 72813004: Fixed crashes exposed though fuzzing. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix nits Created 7 years, 1 month 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 | « no previous file | src/arm/lithium-arm.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 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 3467 matching lines...) Expand 10 before | Expand all | Expand 10 after
3478 __ jmp(&done); 3478 __ jmp(&done);
3479 } 3479 }
3480 3480
3481 __ bind(&not_date_object); 3481 __ bind(&not_date_object);
3482 __ CallRuntime(Runtime::kThrowNotDateError, 0); 3482 __ CallRuntime(Runtime::kThrowNotDateError, 0);
3483 __ bind(&done); 3483 __ bind(&done);
3484 context()->Plug(r0); 3484 context()->Plug(r0);
3485 } 3485 }
3486 3486
3487 3487
3488 void FullCodeGenerator::EmitSeqStringSetCharCheck(Register string,
3489 Register index,
3490 Register value,
3491 uint32_t encoding_mask) {
3492 __ SmiTst(index);
3493 __ Check(eq, kNonSmiIndex);
3494 __ SmiTst(value);
3495 __ Check(eq, kNonSmiValue);
3496
3497 __ ldr(ip, FieldMemOperand(string, String::kLengthOffset));
3498 __ cmp(index, ip);
3499 __ Check(lt, kIndexIsTooLarge);
3500
3501 __ cmp(index, Operand(Smi::FromInt(0)));
3502 __ Check(ge, kIndexIsNegative);
3503
3504 __ ldr(ip, FieldMemOperand(string, HeapObject::kMapOffset));
3505 __ ldrb(ip, FieldMemOperand(ip, Map::kInstanceTypeOffset));
3506
3507 __ and_(ip, ip, Operand(kStringRepresentationMask | kStringEncodingMask));
3508 __ cmp(ip, Operand(encoding_mask));
3509 __ Check(eq, kUnexpectedStringType);
3510 }
3511
3512
3513 void FullCodeGenerator::EmitOneByteSeqStringSetChar(CallRuntime* expr) { 3488 void FullCodeGenerator::EmitOneByteSeqStringSetChar(CallRuntime* expr) {
3514 ZoneList<Expression*>* args = expr->arguments(); 3489 ZoneList<Expression*>* args = expr->arguments();
3515 ASSERT_EQ(3, args->length()); 3490 ASSERT_EQ(3, args->length());
3516 3491
3517 Register string = r0; 3492 Register string = r0;
3518 Register index = r1; 3493 Register index = r1;
3519 Register value = r2; 3494 Register value = r2;
3520 3495
3521 VisitForStackValue(args->at(1)); // index 3496 VisitForStackValue(args->at(1)); // index
3522 VisitForStackValue(args->at(2)); // value 3497 VisitForStackValue(args->at(2)); // value
3523 __ Pop(index, value); 3498 __ Pop(index, value);
3524 VisitForAccumulatorValue(args->at(0)); // string 3499 VisitForAccumulatorValue(args->at(0)); // string
3525 3500
3526 if (FLAG_debug_code) { 3501 if (FLAG_debug_code) {
3502 __ SmiTst(value);
3503 __ ThrowIf(ne, kNonSmiValue);
3504 __ SmiTst(index);
3505 __ ThrowIf(ne, kNonSmiIndex);
3506 __ SmiUntag(index, index);
3527 static const uint32_t one_byte_seq_type = kSeqStringTag | kOneByteStringTag; 3507 static const uint32_t one_byte_seq_type = kSeqStringTag | kOneByteStringTag;
3528 EmitSeqStringSetCharCheck(string, index, value, one_byte_seq_type); 3508 __ EmitSeqStringSetCharCheck(string, index, value, one_byte_seq_type);
3509 __ SmiTag(index, index);
3529 } 3510 }
3530 3511
3531 __ SmiUntag(value, value); 3512 __ SmiUntag(value, value);
3532 __ add(ip, 3513 __ add(ip,
3533 string, 3514 string,
3534 Operand(SeqOneByteString::kHeaderSize - kHeapObjectTag)); 3515 Operand(SeqOneByteString::kHeaderSize - kHeapObjectTag));
3535 __ strb(value, MemOperand(ip, index, LSR, kSmiTagSize)); 3516 __ strb(value, MemOperand(ip, index, LSR, kSmiTagSize));
3536 context()->Plug(string); 3517 context()->Plug(string);
3537 } 3518 }
3538 3519
3539 3520
3540 void FullCodeGenerator::EmitTwoByteSeqStringSetChar(CallRuntime* expr) { 3521 void FullCodeGenerator::EmitTwoByteSeqStringSetChar(CallRuntime* expr) {
3541 ZoneList<Expression*>* args = expr->arguments(); 3522 ZoneList<Expression*>* args = expr->arguments();
3542 ASSERT_EQ(3, args->length()); 3523 ASSERT_EQ(3, args->length());
3543 3524
3544 Register string = r0; 3525 Register string = r0;
3545 Register index = r1; 3526 Register index = r1;
3546 Register value = r2; 3527 Register value = r2;
3547 3528
3548 VisitForStackValue(args->at(1)); // index 3529 VisitForStackValue(args->at(1)); // index
3549 VisitForStackValue(args->at(2)); // value 3530 VisitForStackValue(args->at(2)); // value
3550 __ Pop(index, value); 3531 __ Pop(index, value);
3551 VisitForAccumulatorValue(args->at(0)); // string 3532 VisitForAccumulatorValue(args->at(0)); // string
3552 3533
3553 if (FLAG_debug_code) { 3534 if (FLAG_debug_code) {
3535 __ SmiTst(value);
3536 __ ThrowIf(ne, kNonSmiValue);
3537 __ SmiTst(index);
3538 __ ThrowIf(ne, kNonSmiIndex);
3539 __ SmiUntag(index, index);
3554 static const uint32_t two_byte_seq_type = kSeqStringTag | kTwoByteStringTag; 3540 static const uint32_t two_byte_seq_type = kSeqStringTag | kTwoByteStringTag;
3555 EmitSeqStringSetCharCheck(string, index, value, two_byte_seq_type); 3541 __ EmitSeqStringSetCharCheck(string, index, value, two_byte_seq_type);
3542 __ SmiTag(index, index);
3556 } 3543 }
3557 3544
3558 __ SmiUntag(value, value); 3545 __ SmiUntag(value, value);
3559 __ add(ip, 3546 __ add(ip,
3560 string, 3547 string,
3561 Operand(SeqTwoByteString::kHeaderSize - kHeapObjectTag)); 3548 Operand(SeqTwoByteString::kHeaderSize - kHeapObjectTag));
3562 STATIC_ASSERT(kSmiTagSize == 1 && kSmiTag == 0); 3549 STATIC_ASSERT(kSmiTagSize == 1 && kSmiTag == 0);
3563 __ strh(value, MemOperand(ip, index)); 3550 __ strh(value, MemOperand(ip, index));
3564 context()->Plug(string); 3551 context()->Plug(string);
3565 } 3552 }
(...skipping 1412 matching lines...) Expand 10 before | Expand all | Expand 10 after
4978 ASSERT(Memory::uint32_at(interrupt_address_pointer) == 4965 ASSERT(Memory::uint32_at(interrupt_address_pointer) ==
4979 reinterpret_cast<uint32_t>( 4966 reinterpret_cast<uint32_t>(
4980 isolate->builtins()->OsrAfterStackCheck()->entry())); 4967 isolate->builtins()->OsrAfterStackCheck()->entry()));
4981 return OSR_AFTER_STACK_CHECK; 4968 return OSR_AFTER_STACK_CHECK;
4982 } 4969 }
4983 4970
4984 4971
4985 } } // namespace v8::internal 4972 } } // namespace v8::internal
4986 4973
4987 #endif // V8_TARGET_ARCH_ARM 4974 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/arm/lithium-arm.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698