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

Side by Side Diff: src/objects-inl.h

Issue 10928083: Add more checks for native callback results. (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/objects.cc ('k') | src/stub-cache.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 1646 matching lines...) Expand 10 before | Expand all | Expand 10 after
1657 JSValue* js_value = JSValue::cast(this); 1657 JSValue* js_value = JSValue::cast(this);
1658 if (!js_value->value()->IsString()) return false; 1658 if (!js_value->value()->IsString()) return false;
1659 1659
1660 String* str = String::cast(js_value->value()); 1660 String* str = String::cast(js_value->value());
1661 if (index >= (uint32_t)str->length()) return false; 1661 if (index >= (uint32_t)str->length()) return false;
1662 1662
1663 return true; 1663 return true;
1664 } 1664 }
1665 1665
1666 1666
1667
1668 void Object::VerifyApiCallResultType() {
1669 #if ENABLE_EXTRA_CHECKS
1670 if (!(IsSmi() ||
1671 IsString() ||
1672 IsSpecObject() ||
1673 IsHeapNumber() ||
1674 IsUndefined() ||
1675 IsTrue() ||
1676 IsFalse() ||
1677 IsNull())) {
1678 FATAL("API call returned invalid object");
1679 }
1680 #endif // ENABLE_EXTRA_CHECKS
1681 }
1682
1683
1667 FixedArrayBase* FixedArrayBase::cast(Object* object) { 1684 FixedArrayBase* FixedArrayBase::cast(Object* object) {
1668 ASSERT(object->IsFixedArray() || object->IsFixedDoubleArray()); 1685 ASSERT(object->IsFixedArray() || object->IsFixedDoubleArray());
1669 return reinterpret_cast<FixedArrayBase*>(object); 1686 return reinterpret_cast<FixedArrayBase*>(object);
1670 } 1687 }
1671 1688
1672 1689
1673 Object* FixedArray::get(int index) { 1690 Object* FixedArray::get(int index) {
1674 ASSERT(index >= 0 && index < this->length()); 1691 ASSERT(index >= 0 && index < this->length());
1675 return READ_FIELD(this, kHeaderSize + index * kPointerSize); 1692 return READ_FIELD(this, kHeaderSize + index * kPointerSize);
1676 } 1693 }
(...skipping 3732 matching lines...) Expand 10 before | Expand all | Expand 10 after
5409 #undef WRITE_UINT32_FIELD 5426 #undef WRITE_UINT32_FIELD
5410 #undef READ_SHORT_FIELD 5427 #undef READ_SHORT_FIELD
5411 #undef WRITE_SHORT_FIELD 5428 #undef WRITE_SHORT_FIELD
5412 #undef READ_BYTE_FIELD 5429 #undef READ_BYTE_FIELD
5413 #undef WRITE_BYTE_FIELD 5430 #undef WRITE_BYTE_FIELD
5414 5431
5415 5432
5416 } } // namespace v8::internal 5433 } } // namespace v8::internal
5417 5434
5418 #endif // V8_OBJECTS_INL_H_ 5435 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | src/stub-cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698