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

Side by Side Diff: src/x64/lithium-codegen-x64.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 1309 matching lines...) Expand 10 before | Expand all | Expand 10 after
1320 __ movq(result, FieldOperand(input, JSValue::kValueOffset)); 1320 __ movq(result, FieldOperand(input, JSValue::kValueOffset));
1321 1321
1322 __ bind(&done); 1322 __ bind(&done);
1323 } 1323 }
1324 1324
1325 1325
1326 void LCodeGen::DoDateField(LDateField* instr) { 1326 void LCodeGen::DoDateField(LDateField* instr) {
1327 Register object = ToRegister(instr->InputAt(0)); 1327 Register object = ToRegister(instr->InputAt(0));
1328 Register result = ToRegister(instr->result()); 1328 Register result = ToRegister(instr->result());
1329 Smi* index = instr->index(); 1329 Smi* index = instr->index();
1330 Label runtime, done; 1330 Label runtime, done, not_date_object;
1331 ASSERT(object.is(result)); 1331 ASSERT(object.is(result));
1332 ASSERT(object.is(rax)); 1332 ASSERT(object.is(rax));
1333 1333
1334 #ifdef DEBUG 1334 Condition cc = masm()->CheckSmi(object);
1335 __ AbortIfSmi(object); 1335 DeoptimizeIf(cc, instr->environment());
1336 __ CmpObjectType(object, JS_DATE_TYPE, kScratchRegister); 1336 __ CmpObjectType(object, JS_DATE_TYPE, kScratchRegister);
1337 __ Assert(equal, "Trying to get date field from non-date."); 1337 DeoptimizeIf(not_equal, instr->environment());
1338 #endif
1339 1338
1340 if (index->value() == 0) { 1339 if (index->value() == 0) {
1341 __ movq(result, FieldOperand(object, JSDate::kValueOffset)); 1340 __ movq(result, FieldOperand(object, JSDate::kValueOffset));
1342 } else { 1341 } else {
1343 if (index->value() < JSDate::kFirstUncachedField) { 1342 if (index->value() < JSDate::kFirstUncachedField) {
1344 ExternalReference stamp = ExternalReference::date_cache_stamp(isolate()); 1343 ExternalReference stamp = ExternalReference::date_cache_stamp(isolate());
1345 __ movq(kScratchRegister, stamp); 1344 __ movq(kScratchRegister, stamp);
1346 __ cmpq(kScratchRegister, FieldOperand(object, 1345 __ cmpq(kScratchRegister, FieldOperand(object,
1347 JSDate::kCacheStampOffset)); 1346 JSDate::kCacheStampOffset));
1348 __ j(not_equal, &runtime, Label::kNear); 1347 __ j(not_equal, &runtime, Label::kNear);
(...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after
1947 1946
1948 __ CmpObjectType(input, TestType(instr->hydrogen()), kScratchRegister); 1947 __ CmpObjectType(input, TestType(instr->hydrogen()), kScratchRegister);
1949 EmitBranch(true_block, false_block, BranchCondition(instr->hydrogen())); 1948 EmitBranch(true_block, false_block, BranchCondition(instr->hydrogen()));
1950 } 1949 }
1951 1950
1952 1951
1953 void LCodeGen::DoGetCachedArrayIndex(LGetCachedArrayIndex* instr) { 1952 void LCodeGen::DoGetCachedArrayIndex(LGetCachedArrayIndex* instr) {
1954 Register input = ToRegister(instr->InputAt(0)); 1953 Register input = ToRegister(instr->InputAt(0));
1955 Register result = ToRegister(instr->result()); 1954 Register result = ToRegister(instr->result());
1956 1955
1957 if (FLAG_debug_code) { 1956 __ AbortIfNotString(input);
1958 __ AbortIfNotString(input);
1959 }
1960 1957
1961 __ movl(result, FieldOperand(input, String::kHashFieldOffset)); 1958 __ movl(result, FieldOperand(input, String::kHashFieldOffset));
1962 ASSERT(String::kHashShift >= kSmiTagSize); 1959 ASSERT(String::kHashShift >= kSmiTagSize);
1963 __ IndexFromHash(result, result); 1960 __ IndexFromHash(result, result);
1964 } 1961 }
1965 1962
1966 1963
1967 void LCodeGen::DoHasCachedArrayIndexAndBranch( 1964 void LCodeGen::DoHasCachedArrayIndexAndBranch(
1968 LHasCachedArrayIndexAndBranch* instr) { 1965 LHasCachedArrayIndexAndBranch* instr) {
1969 Register input = ToRegister(instr->InputAt(0)); 1966 Register input = ToRegister(instr->InputAt(0));
(...skipping 3309 matching lines...) Expand 10 before | Expand all | Expand 10 after
5279 FixedArray::kHeaderSize - kPointerSize)); 5276 FixedArray::kHeaderSize - kPointerSize));
5280 __ bind(&done); 5277 __ bind(&done);
5281 } 5278 }
5282 5279
5283 5280
5284 #undef __ 5281 #undef __
5285 5282
5286 } } // namespace v8::internal 5283 } } // namespace v8::internal
5287 5284
5288 #endif // V8_TARGET_ARCH_X64 5285 #endif // V8_TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698