| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 598 && (HeapObject::cast(this)->map()->instance_type() == | 598 && (HeapObject::cast(this)->map()->instance_type() == |
| 599 JS_MESSAGE_OBJECT_TYPE); | 599 JS_MESSAGE_OBJECT_TYPE); |
| 600 } | 600 } |
| 601 | 601 |
| 602 | 602 |
| 603 bool Object::IsStringWrapper() { | 603 bool Object::IsStringWrapper() { |
| 604 return IsJSValue() && JSValue::cast(this)->value()->IsString(); | 604 return IsJSValue() && JSValue::cast(this)->value()->IsString(); |
| 605 } | 605 } |
| 606 | 606 |
| 607 | 607 |
| 608 bool Object::IsJSProxy() { |
| 609 return Object::IsHeapObject() |
| 610 && HeapObject::cast(this)->map()->instance_type() == JS_PROXY_TYPE; |
| 611 } |
| 612 |
| 613 |
| 608 bool Object::IsProxy() { | 614 bool Object::IsProxy() { |
| 609 return Object::IsHeapObject() | 615 return Object::IsHeapObject() |
| 610 && HeapObject::cast(this)->map()->instance_type() == PROXY_TYPE; | 616 && HeapObject::cast(this)->map()->instance_type() == PROXY_TYPE; |
| 611 } | 617 } |
| 612 | 618 |
| 613 | 619 |
| 614 bool Object::IsBoolean() { | 620 bool Object::IsBoolean() { |
| 615 return IsOddball() && | 621 return IsOddball() && |
| 616 ((Oddball::cast(this)->kind() & Oddball::kNotBooleanMask) == 0); | 622 ((Oddball::cast(this)->kind() & Oddball::kNotBooleanMask) == 0); |
| 617 } | 623 } |
| (...skipping 1163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1781 CAST_ACCESSOR(SharedFunctionInfo) | 1787 CAST_ACCESSOR(SharedFunctionInfo) |
| 1782 CAST_ACCESSOR(Map) | 1788 CAST_ACCESSOR(Map) |
| 1783 CAST_ACCESSOR(JSFunction) | 1789 CAST_ACCESSOR(JSFunction) |
| 1784 CAST_ACCESSOR(GlobalObject) | 1790 CAST_ACCESSOR(GlobalObject) |
| 1785 CAST_ACCESSOR(JSGlobalProxy) | 1791 CAST_ACCESSOR(JSGlobalProxy) |
| 1786 CAST_ACCESSOR(JSGlobalObject) | 1792 CAST_ACCESSOR(JSGlobalObject) |
| 1787 CAST_ACCESSOR(JSBuiltinsObject) | 1793 CAST_ACCESSOR(JSBuiltinsObject) |
| 1788 CAST_ACCESSOR(Code) | 1794 CAST_ACCESSOR(Code) |
| 1789 CAST_ACCESSOR(JSArray) | 1795 CAST_ACCESSOR(JSArray) |
| 1790 CAST_ACCESSOR(JSRegExp) | 1796 CAST_ACCESSOR(JSRegExp) |
| 1797 CAST_ACCESSOR(JSProxy) |
| 1791 CAST_ACCESSOR(Proxy) | 1798 CAST_ACCESSOR(Proxy) |
| 1792 CAST_ACCESSOR(ByteArray) | 1799 CAST_ACCESSOR(ByteArray) |
| 1793 CAST_ACCESSOR(FreeSpace) | 1800 CAST_ACCESSOR(FreeSpace) |
| 1794 CAST_ACCESSOR(ExternalArray) | 1801 CAST_ACCESSOR(ExternalArray) |
| 1795 CAST_ACCESSOR(ExternalByteArray) | 1802 CAST_ACCESSOR(ExternalByteArray) |
| 1796 CAST_ACCESSOR(ExternalUnsignedByteArray) | 1803 CAST_ACCESSOR(ExternalUnsignedByteArray) |
| 1797 CAST_ACCESSOR(ExternalShortArray) | 1804 CAST_ACCESSOR(ExternalShortArray) |
| 1798 CAST_ACCESSOR(ExternalUnsignedShortArray) | 1805 CAST_ACCESSOR(ExternalUnsignedShortArray) |
| 1799 CAST_ACCESSOR(ExternalIntArray) | 1806 CAST_ACCESSOR(ExternalIntArray) |
| 1800 CAST_ACCESSOR(ExternalUnsignedIntArray) | 1807 CAST_ACCESSOR(ExternalUnsignedIntArray) |
| (...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2476 } | 2483 } |
| 2477 | 2484 |
| 2478 | 2485 |
| 2479 Code::ExtraICState Code::extra_ic_state() { | 2486 Code::ExtraICState Code::extra_ic_state() { |
| 2480 ASSERT(is_inline_cache_stub()); | 2487 ASSERT(is_inline_cache_stub()); |
| 2481 return ExtractExtraICStateFromFlags(flags()); | 2488 return ExtractExtraICStateFromFlags(flags()); |
| 2482 } | 2489 } |
| 2483 | 2490 |
| 2484 | 2491 |
| 2485 PropertyType Code::type() { | 2492 PropertyType Code::type() { |
| 2486 ASSERT(ic_state() == MONOMORPHIC); | |
| 2487 return ExtractTypeFromFlags(flags()); | 2493 return ExtractTypeFromFlags(flags()); |
| 2488 } | 2494 } |
| 2489 | 2495 |
| 2490 | 2496 |
| 2491 int Code::arguments_count() { | 2497 int Code::arguments_count() { |
| 2492 ASSERT(is_call_stub() || is_keyed_call_stub() || kind() == STUB); | 2498 ASSERT(is_call_stub() || is_keyed_call_stub() || kind() == STUB); |
| 2493 return ExtractArgumentsCountFromFlags(flags()); | 2499 return ExtractArgumentsCountFromFlags(flags()); |
| 2494 } | 2500 } |
| 2495 | 2501 |
| 2496 | 2502 |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2594 } | 2600 } |
| 2595 | 2601 |
| 2596 | 2602 |
| 2597 void Code::set_check_type(CheckType value) { | 2603 void Code::set_check_type(CheckType value) { |
| 2598 ASSERT(is_call_stub() || is_keyed_call_stub()); | 2604 ASSERT(is_call_stub() || is_keyed_call_stub()); |
| 2599 WRITE_BYTE_FIELD(this, kCheckTypeOffset, value); | 2605 WRITE_BYTE_FIELD(this, kCheckTypeOffset, value); |
| 2600 } | 2606 } |
| 2601 | 2607 |
| 2602 | 2608 |
| 2603 ExternalArrayType Code::external_array_type() { | 2609 ExternalArrayType Code::external_array_type() { |
| 2604 ASSERT(is_external_array_load_stub() || is_external_array_store_stub()); | 2610 ASSERT(is_keyed_load_stub() || is_keyed_store_stub()); |
| 2605 byte type = READ_BYTE_FIELD(this, kExternalArrayTypeOffset); | 2611 byte type = READ_BYTE_FIELD(this, kExternalArrayTypeOffset); |
| 2606 return static_cast<ExternalArrayType>(type); | 2612 return static_cast<ExternalArrayType>(type); |
| 2607 } | 2613 } |
| 2608 | 2614 |
| 2609 | 2615 |
| 2610 void Code::set_external_array_type(ExternalArrayType value) { | 2616 void Code::set_external_array_type(ExternalArrayType value) { |
| 2611 ASSERT(is_external_array_load_stub() || is_external_array_store_stub()); | 2617 ASSERT(is_keyed_load_stub() || is_keyed_store_stub()); |
| 2612 WRITE_BYTE_FIELD(this, kExternalArrayTypeOffset, value); | 2618 WRITE_BYTE_FIELD(this, kExternalArrayTypeOffset, value); |
| 2613 } | 2619 } |
| 2614 | 2620 |
| 2615 | 2621 |
| 2616 byte Code::type_recording_unary_op_type() { | 2622 byte Code::type_recording_unary_op_type() { |
| 2617 ASSERT(is_type_recording_unary_op_stub()); | 2623 ASSERT(is_type_recording_unary_op_stub()); |
| 2618 return READ_BYTE_FIELD(this, kUnaryOpTypeOffset); | 2624 return READ_BYTE_FIELD(this, kUnaryOpTypeOffset); |
| 2619 } | 2625 } |
| 2620 | 2626 |
| 2621 | 2627 |
| (...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3065 } | 3071 } |
| 3066 | 3072 |
| 3067 | 3073 |
| 3068 void SharedFunctionInfo::set_strict_mode(bool value) { | 3074 void SharedFunctionInfo::set_strict_mode(bool value) { |
| 3069 set_compiler_hints(BooleanBit::set(compiler_hints(), | 3075 set_compiler_hints(BooleanBit::set(compiler_hints(), |
| 3070 kStrictModeFunction, | 3076 kStrictModeFunction, |
| 3071 value)); | 3077 value)); |
| 3072 } | 3078 } |
| 3073 | 3079 |
| 3074 | 3080 |
| 3081 bool SharedFunctionInfo::es5_native() { |
| 3082 return BooleanBit::get(compiler_hints(), kES5Native); |
| 3083 } |
| 3084 |
| 3085 |
| 3086 void SharedFunctionInfo::set_es5_native(bool value) { |
| 3087 set_compiler_hints(BooleanBit::set(compiler_hints(), |
| 3088 kES5Native, |
| 3089 value)); |
| 3090 } |
| 3091 |
| 3092 |
| 3075 ACCESSORS(CodeCache, default_cache, FixedArray, kDefaultCacheOffset) | 3093 ACCESSORS(CodeCache, default_cache, FixedArray, kDefaultCacheOffset) |
| 3076 ACCESSORS(CodeCache, normal_type_cache, Object, kNormalTypeCacheOffset) | 3094 ACCESSORS(CodeCache, normal_type_cache, Object, kNormalTypeCacheOffset) |
| 3077 | 3095 |
| 3078 bool Script::HasValidSource() { | 3096 bool Script::HasValidSource() { |
| 3079 Object* src = this->source(); | 3097 Object* src = this->source(); |
| 3080 if (!src->IsString()) return true; | 3098 if (!src->IsString()) return true; |
| 3081 String* src_str = String::cast(src); | 3099 String* src_str = String::cast(src); |
| 3082 if (!StringShape(src_str).IsExternal()) return true; | 3100 if (!StringShape(src_str).IsExternal()) return true; |
| 3083 if (src_str->IsAsciiRepresentation()) { | 3101 if (src_str->IsAsciiRepresentation()) { |
| 3084 return ExternalAsciiString::cast(src)->resource() != NULL; | 3102 return ExternalAsciiString::cast(src)->resource() != NULL; |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3361 | 3379 |
| 3362 | 3380 |
| 3363 void JSBuiltinsObject::set_javascript_builtin_code(Builtins::JavaScript id, | 3381 void JSBuiltinsObject::set_javascript_builtin_code(Builtins::JavaScript id, |
| 3364 Code* value) { | 3382 Code* value) { |
| 3365 ASSERT(id < kJSBuiltinsCount); // id is unsigned. | 3383 ASSERT(id < kJSBuiltinsCount); // id is unsigned. |
| 3366 WRITE_FIELD(this, OffsetOfCodeWithId(id), value); | 3384 WRITE_FIELD(this, OffsetOfCodeWithId(id), value); |
| 3367 ASSERT(!HEAP->InNewSpace(value)); | 3385 ASSERT(!HEAP->InNewSpace(value)); |
| 3368 } | 3386 } |
| 3369 | 3387 |
| 3370 | 3388 |
| 3389 ACCESSORS(JSProxy, handler, Object, kHandlerOffset) |
| 3390 |
| 3391 |
| 3371 Address Proxy::proxy() { | 3392 Address Proxy::proxy() { |
| 3372 return AddressFrom<Address>(READ_INTPTR_FIELD(this, kProxyOffset)); | 3393 return AddressFrom<Address>(READ_INTPTR_FIELD(this, kProxyOffset)); |
| 3373 } | 3394 } |
| 3374 | 3395 |
| 3375 | 3396 |
| 3376 void Proxy::set_proxy(Address value) { | 3397 void Proxy::set_proxy(Address value) { |
| 3377 WRITE_INTPTR_FIELD(this, kProxyOffset, OffsetFrom(value)); | 3398 WRITE_INTPTR_FIELD(this, kProxyOffset, OffsetFrom(value)); |
| 3378 } | 3399 } |
| 3379 | 3400 |
| 3380 | 3401 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 3400 JSMessageObject* JSMessageObject::cast(Object* obj) { | 3421 JSMessageObject* JSMessageObject::cast(Object* obj) { |
| 3401 ASSERT(obj->IsJSMessageObject()); | 3422 ASSERT(obj->IsJSMessageObject()); |
| 3402 ASSERT(HeapObject::cast(obj)->Size() == JSMessageObject::kSize); | 3423 ASSERT(HeapObject::cast(obj)->Size() == JSMessageObject::kSize); |
| 3403 return reinterpret_cast<JSMessageObject*>(obj); | 3424 return reinterpret_cast<JSMessageObject*>(obj); |
| 3404 } | 3425 } |
| 3405 | 3426 |
| 3406 | 3427 |
| 3407 INT_ACCESSORS(Code, instruction_size, kInstructionSizeOffset) | 3428 INT_ACCESSORS(Code, instruction_size, kInstructionSizeOffset) |
| 3408 ACCESSORS(Code, relocation_info, ByteArray, kRelocationInfoOffset) | 3429 ACCESSORS(Code, relocation_info, ByteArray, kRelocationInfoOffset) |
| 3409 ACCESSORS(Code, deoptimization_data, FixedArray, kDeoptimizationDataOffset) | 3430 ACCESSORS(Code, deoptimization_data, FixedArray, kDeoptimizationDataOffset) |
| 3431 ACCESSORS(Code, next_code_flushing_candidate, |
| 3432 Object, kNextCodeFlushingCandidateOffset) |
| 3410 | 3433 |
| 3411 | 3434 |
| 3412 byte* Code::instruction_start() { | 3435 byte* Code::instruction_start() { |
| 3413 return FIELD_ADDR(this, kHeaderSize); | 3436 return FIELD_ADDR(this, kHeaderSize); |
| 3414 } | 3437 } |
| 3415 | 3438 |
| 3416 | 3439 |
| 3417 byte* Code::instruction_end() { | 3440 byte* Code::instruction_end() { |
| 3418 return instruction_start() + instruction_size(); | 3441 return instruction_start() + instruction_size(); |
| 3419 } | 3442 } |
| (...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4064 #undef WRITE_INT_FIELD | 4087 #undef WRITE_INT_FIELD |
| 4065 #undef READ_SHORT_FIELD | 4088 #undef READ_SHORT_FIELD |
| 4066 #undef WRITE_SHORT_FIELD | 4089 #undef WRITE_SHORT_FIELD |
| 4067 #undef READ_BYTE_FIELD | 4090 #undef READ_BYTE_FIELD |
| 4068 #undef WRITE_BYTE_FIELD | 4091 #undef WRITE_BYTE_FIELD |
| 4069 | 4092 |
| 4070 | 4093 |
| 4071 } } // namespace v8::internal | 4094 } } // namespace v8::internal |
| 4072 | 4095 |
| 4073 #endif // V8_OBJECTS_INL_H_ | 4096 #endif // V8_OBJECTS_INL_H_ |
| OLD | NEW |