| OLD | NEW |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_OBJECTS_H_ | 5 #ifndef V8_OBJECTS_H_ |
| 6 #define V8_OBJECTS_H_ | 6 #define V8_OBJECTS_H_ |
| 7 | 7 |
| 8 #include <iosfwd> | 8 #include <iosfwd> |
| 9 | 9 |
| 10 #include "src/assert-scope.h" | 10 #include "src/assert-scope.h" |
| (...skipping 5385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5396 // Code aging -- platform-specific | 5396 // Code aging -- platform-specific |
| 5397 static void PatchPlatformCodeAge(Isolate* isolate, | 5397 static void PatchPlatformCodeAge(Isolate* isolate, |
| 5398 byte* sequence, Age age, | 5398 byte* sequence, Age age, |
| 5399 MarkingParity parity); | 5399 MarkingParity parity); |
| 5400 | 5400 |
| 5401 DISALLOW_IMPLICIT_CONSTRUCTORS(Code); | 5401 DISALLOW_IMPLICIT_CONSTRUCTORS(Code); |
| 5402 }; | 5402 }; |
| 5403 | 5403 |
| 5404 class AbstractCode : public HeapObject { | 5404 class AbstractCode : public HeapObject { |
| 5405 public: | 5405 public: |
| 5406 // All code kinds and INTERPRETED_FUNCTION. |
| 5407 enum Kind { |
| 5408 #define DEFINE_CODE_KIND_ENUM(name) name, |
| 5409 CODE_KIND_LIST(DEFINE_CODE_KIND_ENUM) |
| 5410 #undef DEFINE_CODE_KIND_ENUM |
| 5411 INTERPRETED_FUNCTION, |
| 5412 }; |
| 5413 |
| 5406 int SourcePosition(int offset); | 5414 int SourcePosition(int offset); |
| 5407 int SourceStatementPosition(int offset); | 5415 int SourceStatementPosition(int offset); |
| 5408 | 5416 |
| 5417 // Returns the address of the first instruction. |
| 5418 inline Address instruction_start(); |
| 5419 |
| 5420 // Returns the address right after the last instruction. |
| 5421 inline Address instruction_end(); |
| 5422 |
| 5423 // Returns the of the code instructions. |
| 5424 inline int instruction_size(); |
| 5425 |
| 5426 // Returns true if pc is inside this object's instructions. |
| 5427 inline bool contains(byte* pc); |
| 5428 |
| 5429 // Returns the AbstractCode::Kind of the code. |
| 5430 inline Kind kind(); |
| 5431 |
| 5432 // Calculate the size of the code object to report for log events. This takes |
| 5433 // the layout of the code object into account. |
| 5434 inline int ExecutableSize(); |
| 5435 |
| 5409 DECLARE_CAST(AbstractCode) | 5436 DECLARE_CAST(AbstractCode) |
| 5410 inline int Size(); | |
| 5411 inline Code* GetCode(); | 5437 inline Code* GetCode(); |
| 5412 inline BytecodeArray* GetBytecodeArray(); | 5438 inline BytecodeArray* GetBytecodeArray(); |
| 5413 }; | 5439 }; |
| 5414 | 5440 |
| 5415 // Dependent code is a singly linked list of fixed arrays. Each array contains | 5441 // Dependent code is a singly linked list of fixed arrays. Each array contains |
| 5416 // code objects in weak cells for one dependent group. The suffix of the array | 5442 // code objects in weak cells for one dependent group. The suffix of the array |
| 5417 // can be filled with the undefined value if the number of codes is less than | 5443 // can be filled with the undefined value if the number of codes is less than |
| 5418 // the length of the array. | 5444 // the length of the array. |
| 5419 // | 5445 // |
| 5420 // +------+-----------------+--------+--------+-----+--------+-----------+-----+ | 5446 // +------+-----------------+--------+--------+-----+--------+-----------+-----+ |
| (...skipping 1177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6598 // SharedFunctionInfo describes the JSFunction information that can be | 6624 // SharedFunctionInfo describes the JSFunction information that can be |
| 6599 // shared by multiple instances of the function. | 6625 // shared by multiple instances of the function. |
| 6600 class SharedFunctionInfo: public HeapObject { | 6626 class SharedFunctionInfo: public HeapObject { |
| 6601 public: | 6627 public: |
| 6602 // [name]: Function name. | 6628 // [name]: Function name. |
| 6603 DECL_ACCESSORS(name, Object) | 6629 DECL_ACCESSORS(name, Object) |
| 6604 | 6630 |
| 6605 // [code]: Function code. | 6631 // [code]: Function code. |
| 6606 DECL_ACCESSORS(code, Code) | 6632 DECL_ACCESSORS(code, Code) |
| 6607 | 6633 |
| 6634 // Get the abstract code associated with the function, which will either be |
| 6635 // a Code object or a BytecodeArray. |
| 6636 inline AbstractCode* abstract_code(); |
| 6637 |
| 6608 inline void ReplaceCode(Code* code); | 6638 inline void ReplaceCode(Code* code); |
| 6609 | 6639 |
| 6610 // [optimized_code_map]: Map from native context to optimized code | 6640 // [optimized_code_map]: Map from native context to optimized code |
| 6611 // and a shared literals array. | 6641 // and a shared literals array. |
| 6612 DECL_ACCESSORS(optimized_code_map, FixedArray) | 6642 DECL_ACCESSORS(optimized_code_map, FixedArray) |
| 6613 | 6643 |
| 6614 // Returns entry from optimized code map for specified context and OSR entry. | 6644 // Returns entry from optimized code map for specified context and OSR entry. |
| 6615 // Note that {code == nullptr, literals == nullptr} indicates no matching | 6645 // Note that {code == nullptr, literals == nullptr} indicates no matching |
| 6616 // entry has been found, whereas {code, literals == nullptr} indicates that | 6646 // entry has been found, whereas {code, literals == nullptr} indicates that |
| 6617 // code is context-independent. | 6647 // code is context-independent. |
| (...skipping 812 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7430 | 7460 |
| 7431 // [code]: The generated code object for this function. Executed | 7461 // [code]: The generated code object for this function. Executed |
| 7432 // when the function is invoked, e.g. foo() or new foo(). See | 7462 // when the function is invoked, e.g. foo() or new foo(). See |
| 7433 // [[Call]] and [[Construct]] description in ECMA-262, section | 7463 // [[Call]] and [[Construct]] description in ECMA-262, section |
| 7434 // 8.6.2, page 27. | 7464 // 8.6.2, page 27. |
| 7435 inline Code* code(); | 7465 inline Code* code(); |
| 7436 inline void set_code(Code* code); | 7466 inline void set_code(Code* code); |
| 7437 inline void set_code_no_write_barrier(Code* code); | 7467 inline void set_code_no_write_barrier(Code* code); |
| 7438 inline void ReplaceCode(Code* code); | 7468 inline void ReplaceCode(Code* code); |
| 7439 | 7469 |
| 7470 // Get the abstract code associated with the function, which will either be |
| 7471 // a Code object or a BytecodeArray. |
| 7472 inline AbstractCode* abstract_code(); |
| 7473 |
| 7440 // Tells whether this function inlines the given shared function info. | 7474 // Tells whether this function inlines the given shared function info. |
| 7441 bool Inlines(SharedFunctionInfo* candidate); | 7475 bool Inlines(SharedFunctionInfo* candidate); |
| 7442 | 7476 |
| 7443 // Tells whether or not this function has been optimized. | 7477 // Tells whether or not this function has been optimized. |
| 7444 inline bool IsOptimized(); | 7478 inline bool IsOptimized(); |
| 7445 | 7479 |
| 7446 // Mark this function for lazy recompilation. The function will be | 7480 // Mark this function for lazy recompilation. The function will be |
| 7447 // recompiled the next time it is executed. | 7481 // recompiled the next time it is executed. |
| 7448 void MarkForOptimization(); | 7482 void MarkForOptimization(); |
| 7449 void AttemptConcurrentOptimization(); | 7483 void AttemptConcurrentOptimization(); |
| (...skipping 3384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10834 } | 10868 } |
| 10835 return value; | 10869 return value; |
| 10836 } | 10870 } |
| 10837 }; | 10871 }; |
| 10838 | 10872 |
| 10839 | 10873 |
| 10840 } // NOLINT, false-positive due to second-order macros. | 10874 } // NOLINT, false-positive due to second-order macros. |
| 10841 } // NOLINT, false-positive due to second-order macros. | 10875 } // NOLINT, false-positive due to second-order macros. |
| 10842 | 10876 |
| 10843 #endif // V8_OBJECTS_H_ | 10877 #endif // V8_OBJECTS_H_ |
| OLD | NEW |