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

Side by Side Diff: src/mips/full-codegen-mips.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 | « src/messages.js ('k') | src/mips/lithium-codegen-mips.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 3142 matching lines...) Expand 10 before | Expand all | Expand 10 after
3153 3153
3154 3154
3155 void FullCodeGenerator::EmitDateField(CallRuntime* expr) { 3155 void FullCodeGenerator::EmitDateField(CallRuntime* expr) {
3156 ZoneList<Expression*>* args = expr->arguments(); 3156 ZoneList<Expression*>* args = expr->arguments();
3157 ASSERT(args->length() == 2); 3157 ASSERT(args->length() == 2);
3158 ASSERT_NE(NULL, args->at(1)->AsLiteral()); 3158 ASSERT_NE(NULL, args->at(1)->AsLiteral());
3159 Smi* index = Smi::cast(*(args->at(1)->AsLiteral()->handle())); 3159 Smi* index = Smi::cast(*(args->at(1)->AsLiteral()->handle()));
3160 3160
3161 VisitForAccumulatorValue(args->at(0)); // Load the object. 3161 VisitForAccumulatorValue(args->at(0)); // Load the object.
3162 3162
3163 Label runtime, done; 3163 Label runtime, done, not_date_object;
3164 Register object = v0; 3164 Register object = v0;
3165 Register result = v0; 3165 Register result = v0;
3166 Register scratch0 = t5; 3166 Register scratch0 = t5;
3167 Register scratch1 = a1; 3167 Register scratch1 = a1;
3168 3168
3169 #ifdef DEBUG 3169 __ JumpIfSmi(object, &not_date_object);
3170 __ AbortIfSmi(object);
3171 __ GetObjectType(object, scratch1, scratch1); 3170 __ GetObjectType(object, scratch1, scratch1);
3172 __ Assert(eq, "Trying to get date field from non-date.", 3171 __ Branch(&not_date_object, ne, scratch1, Operand(JS_DATE_TYPE));
3173 scratch1, Operand(JS_DATE_TYPE));
3174 #endif
3175 3172
3176 if (index->value() == 0) { 3173 if (index->value() == 0) {
3177 __ lw(result, FieldMemOperand(object, JSDate::kValueOffset)); 3174 __ lw(result, FieldMemOperand(object, JSDate::kValueOffset));
3175 __ jmp(&done);
3178 } else { 3176 } else {
3179 if (index->value() < JSDate::kFirstUncachedField) { 3177 if (index->value() < JSDate::kFirstUncachedField) {
3180 ExternalReference stamp = ExternalReference::date_cache_stamp(isolate()); 3178 ExternalReference stamp = ExternalReference::date_cache_stamp(isolate());
3181 __ li(scratch1, Operand(stamp)); 3179 __ li(scratch1, Operand(stamp));
3182 __ lw(scratch1, MemOperand(scratch1)); 3180 __ lw(scratch1, MemOperand(scratch1));
3183 __ lw(scratch0, FieldMemOperand(object, JSDate::kCacheStampOffset)); 3181 __ lw(scratch0, FieldMemOperand(object, JSDate::kCacheStampOffset));
3184 __ Branch(&runtime, ne, scratch1, Operand(scratch0)); 3182 __ Branch(&runtime, ne, scratch1, Operand(scratch0));
3185 __ lw(result, FieldMemOperand(object, JSDate::kValueOffset + 3183 __ lw(result, FieldMemOperand(object, JSDate::kValueOffset +
3186 kPointerSize * index->value())); 3184 kPointerSize * index->value()));
3187 __ jmp(&done); 3185 __ jmp(&done);
3188 } 3186 }
3189 __ bind(&runtime); 3187 __ bind(&runtime);
3190 __ PrepareCallCFunction(2, scratch1); 3188 __ PrepareCallCFunction(2, scratch1);
3191 __ li(a1, Operand(index)); 3189 __ li(a1, Operand(index));
3192 __ Move(a0, object); 3190 __ Move(a0, object);
3193 __ CallCFunction(ExternalReference::get_date_field_function(isolate()), 2); 3191 __ CallCFunction(ExternalReference::get_date_field_function(isolate()), 2);
3194 __ bind(&done); 3192 __ jmp(&done);
3195 } 3193 }
3196 3194
3195 __ bind(&not_date_object);
3196 __ CallRuntime(Runtime::kThrowNotDateError, 0);
3197 __ bind(&done);
3197 context()->Plug(v0); 3198 context()->Plug(v0);
3198 } 3199 }
3199 3200
3200 3201
3201 void FullCodeGenerator::EmitMathPow(CallRuntime* expr) { 3202 void FullCodeGenerator::EmitMathPow(CallRuntime* expr) {
3202 // Load the arguments on the stack and call the runtime function. 3203 // Load the arguments on the stack and call the runtime function.
3203 ZoneList<Expression*>* args = expr->arguments(); 3204 ZoneList<Expression*>* args = expr->arguments();
3204 ASSERT(args->length() == 2); 3205 ASSERT(args->length() == 2);
3205 VisitForStackValue(args->at(0)); 3206 VisitForStackValue(args->at(0));
3206 VisitForStackValue(args->at(1)); 3207 VisitForStackValue(args->at(1));
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
3613 3614
3614 context()->Plug(if_true, if_false); 3615 context()->Plug(if_true, if_false);
3615 } 3616 }
3616 3617
3617 3618
3618 void FullCodeGenerator::EmitGetCachedArrayIndex(CallRuntime* expr) { 3619 void FullCodeGenerator::EmitGetCachedArrayIndex(CallRuntime* expr) {
3619 ZoneList<Expression*>* args = expr->arguments(); 3620 ZoneList<Expression*>* args = expr->arguments();
3620 ASSERT(args->length() == 1); 3621 ASSERT(args->length() == 1);
3621 VisitForAccumulatorValue(args->at(0)); 3622 VisitForAccumulatorValue(args->at(0));
3622 3623
3623 if (generate_debug_code_) { 3624 __ AbortIfNotString(v0);
3624 __ AbortIfNotString(v0);
3625 }
3626 3625
3627 __ lw(v0, FieldMemOperand(v0, String::kHashFieldOffset)); 3626 __ lw(v0, FieldMemOperand(v0, String::kHashFieldOffset));
3628 __ IndexFromHash(v0, v0); 3627 __ IndexFromHash(v0, v0);
3629 3628
3630 context()->Plug(v0); 3629 context()->Plug(v0);
3631 } 3630 }
3632 3631
3633 3632
3634 void FullCodeGenerator::EmitFastAsciiArrayJoin(CallRuntime* expr) { 3633 void FullCodeGenerator::EmitFastAsciiArrayJoin(CallRuntime* expr) {
3635 Label bailout, done, one_char_separator, long_separator, 3634 Label bailout, done, one_char_separator, long_separator,
(...skipping 983 matching lines...) Expand 10 before | Expand all | Expand 10 after
4619 *context_length = 0; 4618 *context_length = 0;
4620 return previous_; 4619 return previous_;
4621 } 4620 }
4622 4621
4623 4622
4624 #undef __ 4623 #undef __
4625 4624
4626 } } // namespace v8::internal 4625 } } // namespace v8::internal
4627 4626
4628 #endif // V8_TARGET_ARCH_MIPS 4627 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/messages.js ('k') | src/mips/lithium-codegen-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698