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

Side by Side Diff: src/mips/lithium-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
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 1267 matching lines...) Expand 10 before | Expand all | Expand 10 after
1278 Register object = ToRegister(instr->InputAt(0)); 1278 Register object = ToRegister(instr->InputAt(0));
1279 Register result = ToRegister(instr->result()); 1279 Register result = ToRegister(instr->result());
1280 Register scratch = ToRegister(instr->TempAt(0)); 1280 Register scratch = ToRegister(instr->TempAt(0));
1281 Smi* index = instr->index(); 1281 Smi* index = instr->index();
1282 Label runtime, done; 1282 Label runtime, done;
1283 ASSERT(object.is(a0)); 1283 ASSERT(object.is(a0));
1284 ASSERT(result.is(v0)); 1284 ASSERT(result.is(v0));
1285 ASSERT(!scratch.is(scratch0())); 1285 ASSERT(!scratch.is(scratch0()));
1286 ASSERT(!scratch.is(object)); 1286 ASSERT(!scratch.is(object));
1287 1287
1288 #ifdef DEBUG 1288 __ And(at, object, Operand(kSmiTagMask));
1289 __ AbortIfSmi(object); 1289 DeoptimizeIf(eq, instr->environment(), at, Operand(zero_reg));
1290 __ GetObjectType(object, scratch, scratch); 1290 __ GetObjectType(object, scratch, scratch);
1291 __ Assert(eq, "Trying to get date field from non-date.", 1291 DeoptimizeIf(ne, instr->environment(), scratch, Operand(JS_DATE_TYPE));
1292 scratch, Operand(JS_DATE_TYPE));
1293 #endif
1294 1292
1295 if (index->value() == 0) { 1293 if (index->value() == 0) {
1296 __ lw(result, FieldMemOperand(object, JSDate::kValueOffset)); 1294 __ lw(result, FieldMemOperand(object, JSDate::kValueOffset));
1297 } else { 1295 } else {
1298 if (index->value() < JSDate::kFirstUncachedField) { 1296 if (index->value() < JSDate::kFirstUncachedField) {
1299 ExternalReference stamp = ExternalReference::date_cache_stamp(isolate()); 1297 ExternalReference stamp = ExternalReference::date_cache_stamp(isolate());
1300 __ li(scratch, Operand(stamp)); 1298 __ li(scratch, Operand(stamp));
1301 __ lw(scratch, MemOperand(scratch)); 1299 __ lw(scratch, MemOperand(scratch));
1302 __ lw(scratch0(), FieldMemOperand(object, JSDate::kCacheStampOffset)); 1300 __ lw(scratch0(), FieldMemOperand(object, JSDate::kCacheStampOffset));
1303 __ Branch(&runtime, ne, scratch, Operand(scratch0())); 1301 __ Branch(&runtime, ne, scratch, Operand(scratch0()));
(...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after
1961 BranchCondition(instr->hydrogen()), 1959 BranchCondition(instr->hydrogen()),
1962 scratch, 1960 scratch,
1963 Operand(TestType(instr->hydrogen()))); 1961 Operand(TestType(instr->hydrogen())));
1964 } 1962 }
1965 1963
1966 1964
1967 void LCodeGen::DoGetCachedArrayIndex(LGetCachedArrayIndex* instr) { 1965 void LCodeGen::DoGetCachedArrayIndex(LGetCachedArrayIndex* instr) {
1968 Register input = ToRegister(instr->InputAt(0)); 1966 Register input = ToRegister(instr->InputAt(0));
1969 Register result = ToRegister(instr->result()); 1967 Register result = ToRegister(instr->result());
1970 1968
1971 if (FLAG_debug_code) { 1969 __ AbortIfNotString(input);
1972 __ AbortIfNotString(input);
1973 }
1974 1970
1975 __ lw(result, FieldMemOperand(input, String::kHashFieldOffset)); 1971 __ lw(result, FieldMemOperand(input, String::kHashFieldOffset));
1976 __ IndexFromHash(result, result); 1972 __ IndexFromHash(result, result);
1977 } 1973 }
1978 1974
1979 1975
1980 void LCodeGen::DoHasCachedArrayIndexAndBranch( 1976 void LCodeGen::DoHasCachedArrayIndexAndBranch(
1981 LHasCachedArrayIndexAndBranch* instr) { 1977 LHasCachedArrayIndexAndBranch* instr) {
1982 Register input = ToRegister(instr->InputAt(0)); 1978 Register input = ToRegister(instr->InputAt(0));
1983 Register scratch = scratch0(); 1979 Register scratch = scratch0();
(...skipping 3432 matching lines...) Expand 10 before | Expand all | Expand 10 after
5416 __ Subu(scratch, result, scratch); 5412 __ Subu(scratch, result, scratch);
5417 __ lw(result, FieldMemOperand(scratch, 5413 __ lw(result, FieldMemOperand(scratch,
5418 FixedArray::kHeaderSize - kPointerSize)); 5414 FixedArray::kHeaderSize - kPointerSize));
5419 __ bind(&done); 5415 __ bind(&done);
5420 } 5416 }
5421 5417
5422 5418
5423 #undef __ 5419 #undef __
5424 5420
5425 } } // namespace v8::internal 5421 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698