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