OLD | NEW |
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 3353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3364 | 3364 |
3365 // [code]: Function code. | 3365 // [code]: Function code. |
3366 DECL_ACCESSORS(code, Code) | 3366 DECL_ACCESSORS(code, Code) |
3367 | 3367 |
3368 // [scope_info]: Scope info. | 3368 // [scope_info]: Scope info. |
3369 DECL_ACCESSORS(scope_info, SerializedScopeInfo) | 3369 DECL_ACCESSORS(scope_info, SerializedScopeInfo) |
3370 | 3370 |
3371 // [construct stub]: Code stub for constructing instances of this function. | 3371 // [construct stub]: Code stub for constructing instances of this function. |
3372 DECL_ACCESSORS(construct_stub, Code) | 3372 DECL_ACCESSORS(construct_stub, Code) |
3373 | 3373 |
| 3374 inline Code* unchecked_code(); |
| 3375 |
3374 // Returns if this function has been compiled to native code yet. | 3376 // Returns if this function has been compiled to native code yet. |
3375 inline bool is_compiled(); | 3377 inline bool is_compiled(); |
3376 | 3378 |
3377 // [length]: The function length - usually the number of declared parameters. | 3379 // [length]: The function length - usually the number of declared parameters. |
3378 // Use up to 2^30 parameters. | 3380 // Use up to 2^30 parameters. |
3379 inline int length(); | 3381 inline int length(); |
3380 inline void set_length(int value); | 3382 inline void set_length(int value); |
3381 | 3383 |
3382 // [formal parameter count]: The declared number of parameters. | 3384 // [formal parameter count]: The declared number of parameters. |
3383 inline int formal_parameter_count(); | 3385 inline int formal_parameter_count(); |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3471 | 3473 |
3472 inline bool try_full_codegen(); | 3474 inline bool try_full_codegen(); |
3473 inline void set_try_full_codegen(bool flag); | 3475 inline void set_try_full_codegen(bool flag); |
3474 | 3476 |
3475 // Indicates if this function can be lazy compiled. | 3477 // Indicates if this function can be lazy compiled. |
3476 // This is used to determine if we can safely flush code from a function | 3478 // This is used to determine if we can safely flush code from a function |
3477 // when doing GC if we expect that the function will no longer be used. | 3479 // when doing GC if we expect that the function will no longer be used. |
3478 inline bool allows_lazy_compilation(); | 3480 inline bool allows_lazy_compilation(); |
3479 inline void set_allows_lazy_compilation(bool flag); | 3481 inline void set_allows_lazy_compilation(bool flag); |
3480 | 3482 |
| 3483 // Indicates how many full GCs this function has survived with assigned |
| 3484 // code object. Used to determine when it is relatively safe to flush |
| 3485 // this code object and replace it with lazy compilation stub. |
| 3486 // Age is reset when GC notices that the code object is referenced |
| 3487 // from the stack or compilation cache. |
| 3488 inline int code_age(); |
| 3489 inline void set_code_age(int age); |
| 3490 |
| 3491 |
3481 // Check whether a inlined constructor can be generated with the given | 3492 // Check whether a inlined constructor can be generated with the given |
3482 // prototype. | 3493 // prototype. |
3483 bool CanGenerateInlineConstructor(Object* prototype); | 3494 bool CanGenerateInlineConstructor(Object* prototype); |
3484 | 3495 |
3485 // For functions which only contains this property assignments this provides | 3496 // For functions which only contains this property assignments this provides |
3486 // access to the names for the properties assigned. | 3497 // access to the names for the properties assigned. |
3487 DECL_ACCESSORS(this_property_assignments, Object) | 3498 DECL_ACCESSORS(this_property_assignments, Object) |
3488 inline int this_property_assignments_count(); | 3499 inline int this_property_assignments_count(); |
3489 inline void set_this_property_assignments_count(int value); | 3500 inline void set_this_property_assignments_count(int value); |
3490 String* GetThisPropertyAssignmentName(int index); | 3501 String* GetThisPropertyAssignmentName(int index); |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3601 // the start_position_and_type field. | 3612 // the start_position_and_type field. |
3602 static const int kIsExpressionBit = 0; | 3613 static const int kIsExpressionBit = 0; |
3603 static const int kIsTopLevelBit = 1; | 3614 static const int kIsTopLevelBit = 1; |
3604 static const int kStartPositionShift = 2; | 3615 static const int kStartPositionShift = 2; |
3605 static const int kStartPositionMask = ~((1 << kStartPositionShift) - 1); | 3616 static const int kStartPositionMask = ~((1 << kStartPositionShift) - 1); |
3606 | 3617 |
3607 // Bit positions in compiler_hints. | 3618 // Bit positions in compiler_hints. |
3608 static const int kHasOnlySimpleThisPropertyAssignments = 0; | 3619 static const int kHasOnlySimpleThisPropertyAssignments = 0; |
3609 static const int kTryFullCodegen = 1; | 3620 static const int kTryFullCodegen = 1; |
3610 static const int kAllowLazyCompilation = 2; | 3621 static const int kAllowLazyCompilation = 2; |
| 3622 static const int kCodeAgeShift = 3; |
| 3623 static const int kCodeAgeMask = 7; |
3611 | 3624 |
3612 DISALLOW_IMPLICIT_CONSTRUCTORS(SharedFunctionInfo); | 3625 DISALLOW_IMPLICIT_CONSTRUCTORS(SharedFunctionInfo); |
3613 }; | 3626 }; |
3614 | 3627 |
3615 | 3628 |
3616 // JSFunction describes JavaScript functions. | 3629 // JSFunction describes JavaScript functions. |
3617 class JSFunction: public JSObject { | 3630 class JSFunction: public JSObject { |
3618 public: | 3631 public: |
3619 // [prototype_or_initial_map]: | 3632 // [prototype_or_initial_map]: |
3620 DECL_ACCESSORS(prototype_or_initial_map, Object) | 3633 DECL_ACCESSORS(prototype_or_initial_map, Object) |
3621 | 3634 |
3622 // [shared_function_info]: The information about the function that | 3635 // [shared_function_info]: The information about the function that |
3623 // can be shared by instances. | 3636 // can be shared by instances. |
3624 DECL_ACCESSORS(shared, SharedFunctionInfo) | 3637 DECL_ACCESSORS(shared, SharedFunctionInfo) |
3625 | 3638 |
| 3639 inline SharedFunctionInfo* unchecked_shared(); |
| 3640 |
3626 // [context]: The context for this function. | 3641 // [context]: The context for this function. |
3627 inline Context* context(); | 3642 inline Context* context(); |
3628 inline Object* unchecked_context(); | 3643 inline Object* unchecked_context(); |
3629 inline void set_context(Object* context); | 3644 inline void set_context(Object* context); |
3630 | 3645 |
3631 // [code]: The generated code object for this function. Executed | 3646 // [code]: The generated code object for this function. Executed |
3632 // when the function is invoked, e.g. foo() or new foo(). See | 3647 // when the function is invoked, e.g. foo() or new foo(). See |
3633 // [[Call]] and [[Construct]] description in ECMA-262, section | 3648 // [[Call]] and [[Construct]] description in ECMA-262, section |
3634 // 8.6.2, page 27. | 3649 // 8.6.2, page 27. |
3635 inline Code* code(); | 3650 inline Code* code(); |
3636 inline void set_code(Code* value); | 3651 inline void set_code(Code* value); |
3637 | 3652 |
| 3653 inline Code* unchecked_code(); |
| 3654 |
3638 // Tells whether this function is builtin. | 3655 // Tells whether this function is builtin. |
3639 inline bool IsBuiltin(); | 3656 inline bool IsBuiltin(); |
3640 | 3657 |
3641 // [literals]: Fixed array holding the materialized literals. | 3658 // [literals]: Fixed array holding the materialized literals. |
3642 // | 3659 // |
3643 // If the function contains object, regexp or array literals, the | 3660 // If the function contains object, regexp or array literals, the |
3644 // literals array prefix contains the object, regexp, and array | 3661 // literals array prefix contains the object, regexp, and array |
3645 // function to be used when creating these literals. This is | 3662 // function to be used when creating these literals. This is |
3646 // necessary so that we do not dynamically lookup the object, regexp | 3663 // necessary so that we do not dynamically lookup the object, regexp |
3647 // or array functions. Performing a dynamic lookup, we might end up | 3664 // or array functions. Performing a dynamic lookup, we might end up |
(...skipping 1834 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5482 } else { | 5499 } else { |
5483 value &= ~(1 << bit_position); | 5500 value &= ~(1 << bit_position); |
5484 } | 5501 } |
5485 return value; | 5502 return value; |
5486 } | 5503 } |
5487 }; | 5504 }; |
5488 | 5505 |
5489 } } // namespace v8::internal | 5506 } } // namespace v8::internal |
5490 | 5507 |
5491 #endif // V8_OBJECTS_H_ | 5508 #endif // V8_OBJECTS_H_ |
OLD | NEW |