| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 737 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 748 bool Object::IsTrue() { | 748 bool Object::IsTrue() { |
| 749 return IsOddball() && Oddball::cast(this)->kind() == Oddball::kTrue; | 749 return IsOddball() && Oddball::cast(this)->kind() == Oddball::kTrue; |
| 750 } | 750 } |
| 751 | 751 |
| 752 | 752 |
| 753 bool Object::IsFalse() { | 753 bool Object::IsFalse() { |
| 754 return IsOddball() && Oddball::cast(this)->kind() == Oddball::kFalse; | 754 return IsOddball() && Oddball::cast(this)->kind() == Oddball::kFalse; |
| 755 } | 755 } |
| 756 | 756 |
| 757 | 757 |
| 758 bool Object::IsArgumentsMarker() { |
| 759 return IsOddball() && Oddball::cast(this)->kind() == Oddball::kArgumentMarker; |
| 760 } |
| 761 |
| 762 |
| 758 double Object::Number() { | 763 double Object::Number() { |
| 759 ASSERT(IsNumber()); | 764 ASSERT(IsNumber()); |
| 760 return IsSmi() | 765 return IsSmi() |
| 761 ? static_cast<double>(reinterpret_cast<Smi*>(this)->value()) | 766 ? static_cast<double>(reinterpret_cast<Smi*>(this)->value()) |
| 762 : reinterpret_cast<HeapNumber*>(this)->value(); | 767 : reinterpret_cast<HeapNumber*>(this)->value(); |
| 763 } | 768 } |
| 764 | 769 |
| 765 | 770 |
| 766 MaybeObject* Object::ToSmi() { | 771 MaybeObject* Object::ToSmi() { |
| 767 if (IsSmi()) return this; | 772 if (IsSmi()) return this; |
| (...skipping 1545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2313 static_cast<byte>(value)); | 2318 static_cast<byte>(value)); |
| 2314 } | 2319 } |
| 2315 | 2320 |
| 2316 | 2321 |
| 2317 InstanceType Map::instance_type() { | 2322 InstanceType Map::instance_type() { |
| 2318 return static_cast<InstanceType>(READ_BYTE_FIELD(this, kInstanceTypeOffset)); | 2323 return static_cast<InstanceType>(READ_BYTE_FIELD(this, kInstanceTypeOffset)); |
| 2319 } | 2324 } |
| 2320 | 2325 |
| 2321 | 2326 |
| 2322 void Map::set_instance_type(InstanceType value) { | 2327 void Map::set_instance_type(InstanceType value) { |
| 2323 ASSERT(0 <= value && value < 256); | |
| 2324 WRITE_BYTE_FIELD(this, kInstanceTypeOffset, value); | 2328 WRITE_BYTE_FIELD(this, kInstanceTypeOffset, value); |
| 2325 } | 2329 } |
| 2326 | 2330 |
| 2327 | 2331 |
| 2328 int Map::unused_property_fields() { | 2332 int Map::unused_property_fields() { |
| 2329 return READ_BYTE_FIELD(this, kUnusedPropertyFieldsOffset); | 2333 return READ_BYTE_FIELD(this, kUnusedPropertyFieldsOffset); |
| 2330 } | 2334 } |
| 2331 | 2335 |
| 2332 | 2336 |
| 2333 void Map::set_unused_property_fields(int value) { | 2337 void Map::set_unused_property_fields(int value) { |
| (...skipping 969 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3303 return code() != GetIsolate()->builtins()->builtin(Builtins::LazyCompile); | 3307 return code() != GetIsolate()->builtins()->builtin(Builtins::LazyCompile); |
| 3304 } | 3308 } |
| 3305 | 3309 |
| 3306 | 3310 |
| 3307 int JSFunction::NumberOfLiterals() { | 3311 int JSFunction::NumberOfLiterals() { |
| 3308 return literals()->length(); | 3312 return literals()->length(); |
| 3309 } | 3313 } |
| 3310 | 3314 |
| 3311 | 3315 |
| 3312 Object* JSBuiltinsObject::javascript_builtin(Builtins::JavaScript id) { | 3316 Object* JSBuiltinsObject::javascript_builtin(Builtins::JavaScript id) { |
| 3313 ASSERT(0 <= id && id < kJSBuiltinsCount); | 3317 ASSERT(id < kJSBuiltinsCount); // id is unsigned. |
| 3314 return READ_FIELD(this, OffsetOfFunctionWithId(id)); | 3318 return READ_FIELD(this, OffsetOfFunctionWithId(id)); |
| 3315 } | 3319 } |
| 3316 | 3320 |
| 3317 | 3321 |
| 3318 void JSBuiltinsObject::set_javascript_builtin(Builtins::JavaScript id, | 3322 void JSBuiltinsObject::set_javascript_builtin(Builtins::JavaScript id, |
| 3319 Object* value) { | 3323 Object* value) { |
| 3320 ASSERT(0 <= id && id < kJSBuiltinsCount); | 3324 ASSERT(id < kJSBuiltinsCount); // id is unsigned. |
| 3321 WRITE_FIELD(this, OffsetOfFunctionWithId(id), value); | 3325 WRITE_FIELD(this, OffsetOfFunctionWithId(id), value); |
| 3322 WRITE_BARRIER(this, OffsetOfFunctionWithId(id)); | 3326 WRITE_BARRIER(this, OffsetOfFunctionWithId(id)); |
| 3323 } | 3327 } |
| 3324 | 3328 |
| 3325 | 3329 |
| 3326 Code* JSBuiltinsObject::javascript_builtin_code(Builtins::JavaScript id) { | 3330 Code* JSBuiltinsObject::javascript_builtin_code(Builtins::JavaScript id) { |
| 3327 ASSERT(0 <= id && id < kJSBuiltinsCount); | 3331 ASSERT(id < kJSBuiltinsCount); // id is unsigned. |
| 3328 return Code::cast(READ_FIELD(this, OffsetOfCodeWithId(id))); | 3332 return Code::cast(READ_FIELD(this, OffsetOfCodeWithId(id))); |
| 3329 } | 3333 } |
| 3330 | 3334 |
| 3331 | 3335 |
| 3332 void JSBuiltinsObject::set_javascript_builtin_code(Builtins::JavaScript id, | 3336 void JSBuiltinsObject::set_javascript_builtin_code(Builtins::JavaScript id, |
| 3333 Code* value) { | 3337 Code* value) { |
| 3334 ASSERT(0 <= id && id < kJSBuiltinsCount); | 3338 ASSERT(id < kJSBuiltinsCount); // id is unsigned. |
| 3335 WRITE_FIELD(this, OffsetOfCodeWithId(id), value); | 3339 WRITE_FIELD(this, OffsetOfCodeWithId(id), value); |
| 3336 ASSERT(!HEAP->InNewSpace(value)); | 3340 ASSERT(!HEAP->InNewSpace(value)); |
| 3337 } | 3341 } |
| 3338 | 3342 |
| 3339 | 3343 |
| 3340 Address Proxy::proxy() { | 3344 Address Proxy::proxy() { |
| 3341 return AddressFrom<Address>(READ_INTPTR_FIELD(this, kProxyOffset)); | 3345 return AddressFrom<Address>(READ_INTPTR_FIELD(this, kProxyOffset)); |
| 3342 } | 3346 } |
| 3343 | 3347 |
| 3344 | 3348 |
| (...skipping 661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4006 #undef WRITE_INT_FIELD | 4010 #undef WRITE_INT_FIELD |
| 4007 #undef READ_SHORT_FIELD | 4011 #undef READ_SHORT_FIELD |
| 4008 #undef WRITE_SHORT_FIELD | 4012 #undef WRITE_SHORT_FIELD |
| 4009 #undef READ_BYTE_FIELD | 4013 #undef READ_BYTE_FIELD |
| 4010 #undef WRITE_BYTE_FIELD | 4014 #undef WRITE_BYTE_FIELD |
| 4011 | 4015 |
| 4012 | 4016 |
| 4013 } } // namespace v8::internal | 4017 } } // namespace v8::internal |
| 4014 | 4018 |
| 4015 #endif // V8_OBJECTS_INL_H_ | 4019 #endif // V8_OBJECTS_INL_H_ |
| OLD | NEW |