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

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

Issue 10915062: Add checks to runtime functions. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 3 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 | « no previous file | src/arm/lithium-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 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 3116 matching lines...) Expand 10 before | Expand all | Expand 10 after
3127 3127
3128 3128
3129 void FullCodeGenerator::EmitDateField(CallRuntime* expr) { 3129 void FullCodeGenerator::EmitDateField(CallRuntime* expr) {
3130 ZoneList<Expression*>* args = expr->arguments(); 3130 ZoneList<Expression*>* args = expr->arguments();
3131 ASSERT(args->length() == 2); 3131 ASSERT(args->length() == 2);
3132 ASSERT_NE(NULL, args->at(1)->AsLiteral()); 3132 ASSERT_NE(NULL, args->at(1)->AsLiteral());
3133 Smi* index = Smi::cast(*(args->at(1)->AsLiteral()->handle())); 3133 Smi* index = Smi::cast(*(args->at(1)->AsLiteral()->handle()));
3134 3134
3135 VisitForAccumulatorValue(args->at(0)); // Load the object. 3135 VisitForAccumulatorValue(args->at(0)); // Load the object.
3136 3136
3137 Label runtime, done; 3137 Label runtime, done, not_date_object;
3138 Register object = r0; 3138 Register object = r0;
3139 Register result = r0; 3139 Register result = r0;
3140 Register scratch0 = r9; 3140 Register scratch0 = r9;
3141 Register scratch1 = r1; 3141 Register scratch1 = r1;
3142 3142
3143 #ifdef DEBUG 3143 __ JumpIfSmi(object, &not_date_object);
3144 __ AbortIfSmi(object);
3145 __ CompareObjectType(object, scratch1, scratch1, JS_DATE_TYPE); 3144 __ CompareObjectType(object, scratch1, scratch1, JS_DATE_TYPE);
3146 __ Assert(eq, "Trying to get date field from non-date."); 3145 __ b(ne, &not_date_object);
3147 #endif
3148 3146
3149 if (index->value() == 0) { 3147 if (index->value() == 0) {
3150 __ ldr(result, FieldMemOperand(object, JSDate::kValueOffset)); 3148 __ ldr(result, FieldMemOperand(object, JSDate::kValueOffset));
3149 __ jmp(&done);
3151 } else { 3150 } else {
3152 if (index->value() < JSDate::kFirstUncachedField) { 3151 if (index->value() < JSDate::kFirstUncachedField) {
3153 ExternalReference stamp = ExternalReference::date_cache_stamp(isolate()); 3152 ExternalReference stamp = ExternalReference::date_cache_stamp(isolate());
3154 __ mov(scratch1, Operand(stamp)); 3153 __ mov(scratch1, Operand(stamp));
3155 __ ldr(scratch1, MemOperand(scratch1)); 3154 __ ldr(scratch1, MemOperand(scratch1));
3156 __ ldr(scratch0, FieldMemOperand(object, JSDate::kCacheStampOffset)); 3155 __ ldr(scratch0, FieldMemOperand(object, JSDate::kCacheStampOffset));
3157 __ cmp(scratch1, scratch0); 3156 __ cmp(scratch1, scratch0);
3158 __ b(ne, &runtime); 3157 __ b(ne, &runtime);
3159 __ ldr(result, FieldMemOperand(object, JSDate::kValueOffset + 3158 __ ldr(result, FieldMemOperand(object, JSDate::kValueOffset +
3160 kPointerSize * index->value())); 3159 kPointerSize * index->value()));
3161 __ jmp(&done); 3160 __ jmp(&done);
3162 } 3161 }
3163 __ bind(&runtime); 3162 __ bind(&runtime);
3164 __ PrepareCallCFunction(2, scratch1); 3163 __ PrepareCallCFunction(2, scratch1);
3165 __ mov(r1, Operand(index)); 3164 __ mov(r1, Operand(index));
3166 __ CallCFunction(ExternalReference::get_date_field_function(isolate()), 2); 3165 __ CallCFunction(ExternalReference::get_date_field_function(isolate()), 2);
3167 __ bind(&done); 3166 __ jmp(&done);
3168 } 3167 }
3168
3169 __ bind(&not_date_object);
3170 __ CallRuntime(Runtime::kThrowNotDateError, 0);
3171 __ bind(&done);
3169 context()->Plug(r0); 3172 context()->Plug(r0);
3170 } 3173 }
3171 3174
3172 3175
3173 void FullCodeGenerator::EmitMathPow(CallRuntime* expr) { 3176 void FullCodeGenerator::EmitMathPow(CallRuntime* expr) {
3174 // Load the arguments on the stack and call the runtime function. 3177 // Load the arguments on the stack and call the runtime function.
3175 ZoneList<Expression*>* args = expr->arguments(); 3178 ZoneList<Expression*>* args = expr->arguments();
3176 ASSERT(args->length() == 2); 3179 ASSERT(args->length() == 2);
3177 VisitForStackValue(args->at(0)); 3180 VisitForStackValue(args->at(0));
3178 VisitForStackValue(args->at(1)); 3181 VisitForStackValue(args->at(1));
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
3573 3576
3574 context()->Plug(if_true, if_false); 3577 context()->Plug(if_true, if_false);
3575 } 3578 }
3576 3579
3577 3580
3578 void FullCodeGenerator::EmitGetCachedArrayIndex(CallRuntime* expr) { 3581 void FullCodeGenerator::EmitGetCachedArrayIndex(CallRuntime* expr) {
3579 ZoneList<Expression*>* args = expr->arguments(); 3582 ZoneList<Expression*>* args = expr->arguments();
3580 ASSERT(args->length() == 1); 3583 ASSERT(args->length() == 1);
3581 VisitForAccumulatorValue(args->at(0)); 3584 VisitForAccumulatorValue(args->at(0));
3582 3585
3583 if (generate_debug_code_) { 3586 __ AbortIfNotString(r0);
3584 __ AbortIfNotString(r0); 3587
3585 }
3586 3588
3587 __ ldr(r0, FieldMemOperand(r0, String::kHashFieldOffset)); 3589 __ ldr(r0, FieldMemOperand(r0, String::kHashFieldOffset));
3588 __ IndexFromHash(r0, r0); 3590 __ IndexFromHash(r0, r0);
3589 3591
3590 context()->Plug(r0); 3592 context()->Plug(r0);
3591 } 3593 }
3592 3594
3593 3595
3594 void FullCodeGenerator::EmitFastAsciiArrayJoin(CallRuntime* expr) { 3596 void FullCodeGenerator::EmitFastAsciiArrayJoin(CallRuntime* expr) {
3595 Label bailout, done, one_char_separator, long_separator, 3597 Label bailout, done, one_char_separator, long_separator,
(...skipping 980 matching lines...) Expand 10 before | Expand all | Expand 10 after
4576 *context_length = 0; 4578 *context_length = 0;
4577 return previous_; 4579 return previous_;
4578 } 4580 }
4579 4581
4580 4582
4581 #undef __ 4583 #undef __
4582 4584
4583 } } // namespace v8::internal 4585 } } // namespace v8::internal
4584 4586
4585 #endif // V8_TARGET_ARCH_ARM 4587 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/arm/lithium-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698