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 2676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2687 return Smi::cast(function_data())->value(); | 2687 return Smi::cast(function_data())->value(); |
2688 } | 2688 } |
2689 | 2689 |
2690 | 2690 |
2691 bool JSFunction::IsBuiltin() { | 2691 bool JSFunction::IsBuiltin() { |
2692 return context()->global()->IsJSBuiltinsObject(); | 2692 return context()->global()->IsJSBuiltinsObject(); |
2693 } | 2693 } |
2694 | 2694 |
2695 | 2695 |
2696 Code* JSFunction::code() { | 2696 Code* JSFunction::code() { |
2697 return shared()->code(); | 2697 return Code::cast(READ_FIELD(this, kCodeOffset)); |
2698 } | 2698 } |
2699 | 2699 |
2700 | 2700 |
2701 void JSFunction::set_code(Code* value) { | 2701 void JSFunction::set_code(Code* value) { |
2702 shared()->set_code(value); | 2702 // Skip the write barrier because code is never in new space. |
| 2703 ASSERT(!Heap::InNewSpace(value)); |
| 2704 WRITE_FIELD(this, kCodeOffset, value); |
2703 } | 2705 } |
2704 | 2706 |
2705 | 2707 |
2706 Context* JSFunction::context() { | 2708 Context* JSFunction::context() { |
2707 return Context::cast(READ_FIELD(this, kContextOffset)); | 2709 return Context::cast(READ_FIELD(this, kContextOffset)); |
2708 } | 2710 } |
2709 | 2711 |
2710 | 2712 |
2711 Object* JSFunction::unchecked_context() { | 2713 Object* JSFunction::unchecked_context() { |
2712 return READ_FIELD(this, kContextOffset); | 2714 return READ_FIELD(this, kContextOffset); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2764 if (map()->has_non_instance_prototype()) return map()->constructor(); | 2766 if (map()->has_non_instance_prototype()) return map()->constructor(); |
2765 return instance_prototype(); | 2767 return instance_prototype(); |
2766 } | 2768 } |
2767 | 2769 |
2768 bool JSFunction::should_have_prototype() { | 2770 bool JSFunction::should_have_prototype() { |
2769 return map()->function_with_prototype(); | 2771 return map()->function_with_prototype(); |
2770 } | 2772 } |
2771 | 2773 |
2772 | 2774 |
2773 bool JSFunction::is_compiled() { | 2775 bool JSFunction::is_compiled() { |
2774 return shared()->is_compiled(); | 2776 return code()->kind() != Code::STUB; |
2775 } | 2777 } |
2776 | 2778 |
2777 | 2779 |
2778 int JSFunction::NumberOfLiterals() { | 2780 int JSFunction::NumberOfLiterals() { |
2779 return literals()->length(); | 2781 return literals()->length(); |
2780 } | 2782 } |
2781 | 2783 |
2782 | 2784 |
2783 Object* JSBuiltinsObject::javascript_builtin(Builtins::JavaScript id) { | 2785 Object* JSBuiltinsObject::javascript_builtin(Builtins::JavaScript id) { |
2784 ASSERT(0 <= id && id < kJSBuiltinsCount); | 2786 ASSERT(0 <= id && id < kJSBuiltinsCount); |
(...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3324 #undef WRITE_INT_FIELD | 3326 #undef WRITE_INT_FIELD |
3325 #undef READ_SHORT_FIELD | 3327 #undef READ_SHORT_FIELD |
3326 #undef WRITE_SHORT_FIELD | 3328 #undef WRITE_SHORT_FIELD |
3327 #undef READ_BYTE_FIELD | 3329 #undef READ_BYTE_FIELD |
3328 #undef WRITE_BYTE_FIELD | 3330 #undef WRITE_BYTE_FIELD |
3329 | 3331 |
3330 | 3332 |
3331 } } // namespace v8::internal | 3333 } } // namespace v8::internal |
3332 | 3334 |
3333 #endif // V8_OBJECTS_INL_H_ | 3335 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |