OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 2545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2556 kHasOnlySimpleThisPropertyAssignments) | 2556 kHasOnlySimpleThisPropertyAssignments) |
2557 BOOL_ACCESSORS(SharedFunctionInfo, | 2557 BOOL_ACCESSORS(SharedFunctionInfo, |
2558 compiler_hints, | 2558 compiler_hints, |
2559 try_full_codegen, | 2559 try_full_codegen, |
2560 kTryFullCodegen) | 2560 kTryFullCodegen) |
2561 BOOL_ACCESSORS(SharedFunctionInfo, | 2561 BOOL_ACCESSORS(SharedFunctionInfo, |
2562 compiler_hints, | 2562 compiler_hints, |
2563 allows_lazy_compilation, | 2563 allows_lazy_compilation, |
2564 kAllowLazyCompilation) | 2564 kAllowLazyCompilation) |
2565 | 2565 |
| 2566 |
2566 #if V8_HOST_ARCH_32_BIT | 2567 #if V8_HOST_ARCH_32_BIT |
2567 SMI_ACCESSORS(SharedFunctionInfo, length, kLengthOffset) | 2568 SMI_ACCESSORS(SharedFunctionInfo, length, kLengthOffset) |
2568 SMI_ACCESSORS(SharedFunctionInfo, formal_parameter_count, | 2569 SMI_ACCESSORS(SharedFunctionInfo, formal_parameter_count, |
2569 kFormalParameterCountOffset) | 2570 kFormalParameterCountOffset) |
2570 SMI_ACCESSORS(SharedFunctionInfo, expected_nof_properties, | 2571 SMI_ACCESSORS(SharedFunctionInfo, expected_nof_properties, |
2571 kExpectedNofPropertiesOffset) | 2572 kExpectedNofPropertiesOffset) |
2572 SMI_ACCESSORS(SharedFunctionInfo, num_literals, kNumLiteralsOffset) | 2573 SMI_ACCESSORS(SharedFunctionInfo, num_literals, kNumLiteralsOffset) |
2573 SMI_ACCESSORS(SharedFunctionInfo, start_position_and_type, | 2574 SMI_ACCESSORS(SharedFunctionInfo, start_position_and_type, |
2574 kStartPositionAndTypeOffset) | 2575 kStartPositionAndTypeOffset) |
2575 SMI_ACCESSORS(SharedFunctionInfo, end_position, kEndPositionOffset) | 2576 SMI_ACCESSORS(SharedFunctionInfo, end_position, kEndPositionOffset) |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2655 set_start_position_and_type((start_position << kStartPositionShift) | 2656 set_start_position_and_type((start_position << kStartPositionShift) |
2656 | (start_position_and_type() & ~kStartPositionMask)); | 2657 | (start_position_and_type() & ~kStartPositionMask)); |
2657 } | 2658 } |
2658 | 2659 |
2659 | 2660 |
2660 Code* SharedFunctionInfo::code() { | 2661 Code* SharedFunctionInfo::code() { |
2661 return Code::cast(READ_FIELD(this, kCodeOffset)); | 2662 return Code::cast(READ_FIELD(this, kCodeOffset)); |
2662 } | 2663 } |
2663 | 2664 |
2664 | 2665 |
| 2666 Code* SharedFunctionInfo::unchecked_code() { |
| 2667 return reinterpret_cast<Code*>(READ_FIELD(this, kCodeOffset)); |
| 2668 } |
| 2669 |
| 2670 |
2665 void SharedFunctionInfo::set_code(Code* value, WriteBarrierMode mode) { | 2671 void SharedFunctionInfo::set_code(Code* value, WriteBarrierMode mode) { |
2666 WRITE_FIELD(this, kCodeOffset, value); | 2672 WRITE_FIELD(this, kCodeOffset, value); |
2667 CONDITIONAL_WRITE_BARRIER(this, kCodeOffset, mode); | 2673 CONDITIONAL_WRITE_BARRIER(this, kCodeOffset, mode); |
2668 } | 2674 } |
2669 | 2675 |
2670 | 2676 |
2671 SerializedScopeInfo* SharedFunctionInfo::scope_info() { | 2677 SerializedScopeInfo* SharedFunctionInfo::scope_info() { |
2672 return reinterpret_cast<SerializedScopeInfo*>( | 2678 return reinterpret_cast<SerializedScopeInfo*>( |
2673 READ_FIELD(this, kScopeInfoOffset)); | 2679 READ_FIELD(this, kScopeInfoOffset)); |
2674 } | 2680 } |
(...skipping 26 matching lines...) Expand all Loading... |
2701 return function_data()->IsSmi(); | 2707 return function_data()->IsSmi(); |
2702 } | 2708 } |
2703 | 2709 |
2704 | 2710 |
2705 int SharedFunctionInfo::custom_call_generator_id() { | 2711 int SharedFunctionInfo::custom_call_generator_id() { |
2706 ASSERT(HasCustomCallGenerator()); | 2712 ASSERT(HasCustomCallGenerator()); |
2707 return Smi::cast(function_data())->value(); | 2713 return Smi::cast(function_data())->value(); |
2708 } | 2714 } |
2709 | 2715 |
2710 | 2716 |
| 2717 int SharedFunctionInfo::code_age() { |
| 2718 return (compiler_hints() >> kCodeAgeShift) & kCodeAgeMask; |
| 2719 } |
| 2720 |
| 2721 |
| 2722 void SharedFunctionInfo::set_code_age(int code_age) { |
| 2723 set_compiler_hints(compiler_hints() | |
| 2724 ((code_age & kCodeAgeMask) << kCodeAgeShift)); |
| 2725 } |
| 2726 |
| 2727 |
2711 bool JSFunction::IsBuiltin() { | 2728 bool JSFunction::IsBuiltin() { |
2712 return context()->global()->IsJSBuiltinsObject(); | 2729 return context()->global()->IsJSBuiltinsObject(); |
2713 } | 2730 } |
2714 | 2731 |
2715 | 2732 |
2716 Code* JSFunction::code() { | 2733 Code* JSFunction::code() { |
2717 return Code::cast(READ_FIELD(this, kCodeOffset)); | 2734 return Code::cast(READ_FIELD(this, kCodeOffset)); |
2718 } | 2735 } |
2719 | 2736 |
2720 | 2737 |
| 2738 Code* JSFunction::unchecked_code() { |
| 2739 return reinterpret_cast<Code*>(READ_FIELD(this, kCodeOffset)); |
| 2740 } |
| 2741 |
| 2742 |
2721 void JSFunction::set_code(Code* value) { | 2743 void JSFunction::set_code(Code* value) { |
2722 // Skip the write barrier because code is never in new space. | 2744 // Skip the write barrier because code is never in new space. |
2723 ASSERT(!Heap::InNewSpace(value)); | 2745 ASSERT(!Heap::InNewSpace(value)); |
2724 WRITE_FIELD(this, kCodeOffset, value); | 2746 WRITE_FIELD(this, kCodeOffset, value); |
2725 } | 2747 } |
2726 | 2748 |
2727 | 2749 |
2728 Context* JSFunction::context() { | 2750 Context* JSFunction::context() { |
2729 return Context::cast(READ_FIELD(this, kContextOffset)); | 2751 return Context::cast(READ_FIELD(this, kContextOffset)); |
2730 } | 2752 } |
2731 | 2753 |
2732 | 2754 |
2733 Object* JSFunction::unchecked_context() { | 2755 Object* JSFunction::unchecked_context() { |
2734 return READ_FIELD(this, kContextOffset); | 2756 return READ_FIELD(this, kContextOffset); |
2735 } | 2757 } |
2736 | 2758 |
2737 | 2759 |
| 2760 SharedFunctionInfo* JSFunction::unchecked_shared() { |
| 2761 return reinterpret_cast<SharedFunctionInfo*>( |
| 2762 READ_FIELD(this, kSharedFunctionInfoOffset)); |
| 2763 } |
| 2764 |
| 2765 |
2738 void JSFunction::set_context(Object* value) { | 2766 void JSFunction::set_context(Object* value) { |
2739 ASSERT(value == Heap::undefined_value() || value->IsContext()); | 2767 ASSERT(value == Heap::undefined_value() || value->IsContext()); |
2740 WRITE_FIELD(this, kContextOffset, value); | 2768 WRITE_FIELD(this, kContextOffset, value); |
2741 WRITE_BARRIER(this, kContextOffset); | 2769 WRITE_BARRIER(this, kContextOffset); |
2742 } | 2770 } |
2743 | 2771 |
2744 ACCESSORS(JSFunction, prototype_or_initial_map, Object, | 2772 ACCESSORS(JSFunction, prototype_or_initial_map, Object, |
2745 kPrototypeOrInitialMapOffset) | 2773 kPrototypeOrInitialMapOffset) |
2746 | 2774 |
2747 | 2775 |
(...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3421 #undef WRITE_INT_FIELD | 3449 #undef WRITE_INT_FIELD |
3422 #undef READ_SHORT_FIELD | 3450 #undef READ_SHORT_FIELD |
3423 #undef WRITE_SHORT_FIELD | 3451 #undef WRITE_SHORT_FIELD |
3424 #undef READ_BYTE_FIELD | 3452 #undef READ_BYTE_FIELD |
3425 #undef WRITE_BYTE_FIELD | 3453 #undef WRITE_BYTE_FIELD |
3426 | 3454 |
3427 | 3455 |
3428 } } // namespace v8::internal | 3456 } } // namespace v8::internal |
3429 | 3457 |
3430 #endif // V8_OBJECTS_INL_H_ | 3458 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |