Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(48)

Side by Side Diff: src/objects.h

Issue 2649873002: Split some SharedFunctionInfo's compiler hints off into debugger hints. (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/ia32/macro-assembler-ia32.h ('k') | src/objects-inl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include <memory> 9 #include <memory>
10 10
(...skipping 7274 matching lines...) Expand 10 before | Expand all | Expand 10 after
7285 // [function data]: This field holds some additional data for function. 7285 // [function data]: This field holds some additional data for function.
7286 // Currently it has one of: 7286 // Currently it has one of:
7287 // - a FunctionTemplateInfo to make benefit the API [IsApiFunction()]. 7287 // - a FunctionTemplateInfo to make benefit the API [IsApiFunction()].
7288 // - a BytecodeArray for the interpreter [HasBytecodeArray()]. 7288 // - a BytecodeArray for the interpreter [HasBytecodeArray()].
7289 // - a FixedArray with Asm->Wasm conversion [HasAsmWasmData()]. 7289 // - a FixedArray with Asm->Wasm conversion [HasAsmWasmData()].
7290 DECL_ACCESSORS(function_data, Object) 7290 DECL_ACCESSORS(function_data, Object)
7291 7291
7292 inline bool IsApiFunction(); 7292 inline bool IsApiFunction();
7293 inline FunctionTemplateInfo* get_api_func_data(); 7293 inline FunctionTemplateInfo* get_api_func_data();
7294 inline void set_api_func_data(FunctionTemplateInfo* data); 7294 inline void set_api_func_data(FunctionTemplateInfo* data);
7295 inline bool HasBytecodeArray(); 7295 inline bool HasBytecodeArray() const;
7296 inline BytecodeArray* bytecode_array(); 7296 inline BytecodeArray* bytecode_array() const;
7297 inline void set_bytecode_array(BytecodeArray* bytecode); 7297 inline void set_bytecode_array(BytecodeArray* bytecode);
7298 inline void ClearBytecodeArray(); 7298 inline void ClearBytecodeArray();
7299 inline bool HasAsmWasmData(); 7299 inline bool HasAsmWasmData() const;
7300 inline FixedArray* asm_wasm_data(); 7300 inline FixedArray* asm_wasm_data() const;
7301 inline void set_asm_wasm_data(FixedArray* data); 7301 inline void set_asm_wasm_data(FixedArray* data);
7302 inline void ClearAsmWasmData(); 7302 inline void ClearAsmWasmData();
7303 7303
7304 // [function identifier]: This field holds an additional identifier for the 7304 // [function identifier]: This field holds an additional identifier for the
7305 // function. 7305 // function.
7306 // - a Smi identifying a builtin function [HasBuiltinFunctionId()]. 7306 // - a Smi identifying a builtin function [HasBuiltinFunctionId()].
7307 // - a String identifying the function's inferred name [HasInferredName()]. 7307 // - a String identifying the function's inferred name [HasInferredName()].
7308 // The inferred_name is inferred from variable or property 7308 // The inferred_name is inferred from variable or property
7309 // assignment of this function. It is used to facilitate debugging and 7309 // assignment of this function. It is used to facilitate debugging and
7310 // profiling of JavaScript code written in OO style, where almost 7310 // profiling of JavaScript code written in OO style, where almost
(...skipping 17 matching lines...) Expand all
7328 7328
7329 // [start_position_and_type]: Field used to store both the source code 7329 // [start_position_and_type]: Field used to store both the source code
7330 // position, whether or not the function is a function expression, 7330 // position, whether or not the function is a function expression,
7331 // and whether or not the function is a toplevel function. The two 7331 // and whether or not the function is a toplevel function. The two
7332 // least significants bit indicates whether the function is an 7332 // least significants bit indicates whether the function is an
7333 // expression and the rest contains the source code position. 7333 // expression and the rest contains the source code position.
7334 inline int start_position_and_type() const; 7334 inline int start_position_and_type() const;
7335 inline void set_start_position_and_type(int value); 7335 inline void set_start_position_and_type(int value);
7336 7336
7337 // The function is subject to debugging if a debug info is attached. 7337 // The function is subject to debugging if a debug info is attached.
7338 inline bool HasDebugInfo(); 7338 inline bool HasDebugInfo() const;
7339 inline DebugInfo* GetDebugInfo(); 7339 inline DebugInfo* GetDebugInfo() const;
7340 7340
7341 // A function has debug code if the compiled code has debug break slots. 7341 // A function has debug code if the compiled code has debug break slots.
7342 inline bool HasDebugCode(); 7342 inline bool HasDebugCode() const;
7343 7343
7344 // [debug info]: Debug information. 7344 // [debug info]: Debug information.
7345 DECL_ACCESSORS(debug_info, Object) 7345 DECL_ACCESSORS(debug_info, Object)
7346 7346
7347 // Bit field containing various information collected for debugging.
7348 // This field is either stored on the kDebugInfo slot or inside the
7349 // debug info struct.
7350 inline int debugger_hints() const;
7351 inline void set_debugger_hints(int value);
7352
7353 // Indicates that the function was created by the Function function.
7354 // Though it's anonymous, toString should treat it as if it had the name
7355 // "anonymous". We don't set the name itself so that the system does not
7356 // see a binding for it.
7357 DECL_BOOLEAN_ACCESSORS(name_should_print_as_anonymous)
7358
7359 // Indicates that the function is either an anonymous expression
7360 // or an arrow function (the name field can be set through the API,
7361 // which does not change this flag).
7362 DECL_BOOLEAN_ACCESSORS(is_anonymous_expression)
7363
7364 // Indicates that the the shared function info is deserialized from cache.
7365 DECL_BOOLEAN_ACCESSORS(deserialized)
7366
7367 // Indicates that the function cannot cause side-effects.
7368 DECL_BOOLEAN_ACCESSORS(has_no_side_effect)
7369
7370 // Indicates that |has_no_side_effect| has been computed and set.
7371 DECL_BOOLEAN_ACCESSORS(computed_has_no_side_effect)
7372
7347 // The function's name if it is non-empty, otherwise the inferred name. 7373 // The function's name if it is non-empty, otherwise the inferred name.
7348 String* DebugName(); 7374 String* DebugName();
7349 7375
7350 // The function cannot cause any side effects. 7376 // The function cannot cause any side effects.
7351 bool HasNoSideEffect(); 7377 bool HasNoSideEffect();
7352 7378
7353 // Used for flags such as --hydrogen-filter. 7379 // Used for flags such as --hydrogen-filter.
7354 bool PassesFilter(const char* raw_filter); 7380 bool PassesFilter(const char* raw_filter);
7355 7381
7356 // Position of the 'function' token in the script source. 7382 // Position of the 'function' token in the script source.
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
7415 7441
7416 // Indicates whether the function is a native function. 7442 // Indicates whether the function is a native function.
7417 // These needs special treatment in .call and .apply since 7443 // These needs special treatment in .call and .apply since
7418 // null passed as the receiver should not be translated to the 7444 // null passed as the receiver should not be translated to the
7419 // global object. 7445 // global object.
7420 DECL_BOOLEAN_ACCESSORS(native) 7446 DECL_BOOLEAN_ACCESSORS(native)
7421 7447
7422 // Indicate that this function should always be inlined in optimized code. 7448 // Indicate that this function should always be inlined in optimized code.
7423 DECL_BOOLEAN_ACCESSORS(force_inline) 7449 DECL_BOOLEAN_ACCESSORS(force_inline)
7424 7450
7425 // Indicates that the function was created by the Function function.
7426 // Though it's anonymous, toString should treat it as if it had the name
7427 // "anonymous". We don't set the name itself so that the system does not
7428 // see a binding for it.
7429 DECL_BOOLEAN_ACCESSORS(name_should_print_as_anonymous)
7430
7431 // Indicates that the function is either an anonymous expression
7432 // or an arrow function (the name field can be set through the API,
7433 // which does not change this flag).
7434 DECL_BOOLEAN_ACCESSORS(is_anonymous_expression)
7435
7436 // Indicates that code for this function must be compiled through the 7451 // Indicates that code for this function must be compiled through the
7437 // Ignition / TurboFan pipeline, and is unsupported by 7452 // Ignition / TurboFan pipeline, and is unsupported by
7438 // FullCodegen / Crankshaft. 7453 // FullCodegen / Crankshaft.
7439 DECL_BOOLEAN_ACCESSORS(must_use_ignition_turbo) 7454 DECL_BOOLEAN_ACCESSORS(must_use_ignition_turbo)
7440 7455
7441 // Indicates that code for this function cannot be flushed. 7456 // Indicates that code for this function cannot be flushed.
7442 DECL_BOOLEAN_ACCESSORS(dont_flush) 7457 DECL_BOOLEAN_ACCESSORS(dont_flush)
7443 7458
7444 // Indicates that this function is an asm function. 7459 // Indicates that this function is an asm function.
7445 DECL_BOOLEAN_ACCESSORS(asm_function) 7460 DECL_BOOLEAN_ACCESSORS(asm_function)
7446 7461
7447 // Indicates that the the shared function info is deserialized from cache.
7448 DECL_BOOLEAN_ACCESSORS(deserialized)
7449
7450 // Whether this function was created from a FunctionDeclaration. 7462 // Whether this function was created from a FunctionDeclaration.
7451 DECL_BOOLEAN_ACCESSORS(is_declaration) 7463 DECL_BOOLEAN_ACCESSORS(is_declaration)
7452 7464
7453 // Whether this function was marked to be tiered up. 7465 // Whether this function was marked to be tiered up.
7454 DECL_BOOLEAN_ACCESSORS(marked_for_tier_up) 7466 DECL_BOOLEAN_ACCESSORS(marked_for_tier_up)
7455 7467
7456 // Indicates that asm->wasm conversion failed and should not be re-attempted. 7468 // Indicates that asm->wasm conversion failed and should not be re-attempted.
7457 DECL_BOOLEAN_ACCESSORS(is_asm_wasm_broken) 7469 DECL_BOOLEAN_ACCESSORS(is_asm_wasm_broken)
7458 7470
7459 // Indicates that the function cannot cause side-effects.
7460 DECL_BOOLEAN_ACCESSORS(has_no_side_effect)
7461
7462 // Indicates that |has_no_side_effect| has been computed and set.
7463 DECL_BOOLEAN_ACCESSORS(computed_has_no_side_effect)
7464
7465 inline FunctionKind kind() const; 7471 inline FunctionKind kind() const;
7466 inline void set_kind(FunctionKind kind); 7472 inline void set_kind(FunctionKind kind);
7467 7473
7468 // Indicates whether or not the code in the shared function support 7474 // Indicates whether or not the code in the shared function support
7469 // deoptimization. 7475 // deoptimization.
7470 inline bool has_deoptimization_support(); 7476 inline bool has_deoptimization_support();
7471 7477
7472 // Enable deoptimization support through recompiled code. 7478 // Enable deoptimization support through recompiled code.
7473 void EnableDeoptimizationSupport(Code* recompiled); 7479 void EnableDeoptimizationSupport(Code* recompiled);
7474 7480
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
7729 kMarkedForTierUp, 7735 kMarkedForTierUp,
7730 kOptimizationDisabled, 7736 kOptimizationDisabled,
7731 kHasDuplicateParameters, 7737 kHasDuplicateParameters,
7732 kNative, 7738 kNative,
7733 kStrictModeFunction, 7739 kStrictModeFunction,
7734 kUsesArguments, 7740 kUsesArguments,
7735 kNeedsHomeObject, 7741 kNeedsHomeObject,
7736 // byte 1 7742 // byte 1
7737 kForceInline, 7743 kForceInline,
7738 kIsAsmFunction, 7744 kIsAsmFunction,
7739 kIsAnonymousExpression,
7740 kNameShouldPrintAsAnonymous,
7741 kMustUseIgnitionTurbo, 7745 kMustUseIgnitionTurbo,
7742 kDontFlush, 7746 kDontFlush,
7743 kIsDeclaration, 7747 kIsDeclaration,
7748 kIsAsmWasmBroken,
7744 7749
7745 kUnused, // unused. 7750 kUnused1, // Unused fields.
7751 kUnused2,
7752
7746 // byte 2 7753 // byte 2
7747 kFunctionKind, 7754 kFunctionKind,
7748 // rest of byte 2 and first two bits of byte 3 are used by FunctionKind 7755 // rest of byte 2 and first two bits of byte 3 are used by FunctionKind
7749 // byte 3 7756 // byte 3
7750 kDeserialized = kFunctionKind + 10, 7757 kCompilerHintsCount = kFunctionKind + 10, // Pseudo entry
7751 kIsAsmWasmBroken, 7758 };
7759
7760 // Bit positions in debugger_hints.
7761 enum DebuggerHints {
7762 kIsAnonymousExpression,
7763 kNameShouldPrintAsAnonymous,
7764 kDeserialized,
7752 kHasNoSideEffect, 7765 kHasNoSideEffect,
7753 kComputedHasNoSideEffect, 7766 kComputedHasNoSideEffect,
7754 kCompilerHintsCount, // Pseudo entry
7755 }; 7767 };
7768
7756 // kFunctionKind has to be byte-aligned 7769 // kFunctionKind has to be byte-aligned
7757 STATIC_ASSERT((kFunctionKind % kBitsPerByte) == 0); 7770 STATIC_ASSERT((kFunctionKind % kBitsPerByte) == 0);
7758 7771
7759 class FunctionKindBits : public BitField<FunctionKind, kFunctionKind, 10> {}; 7772 class FunctionKindBits : public BitField<FunctionKind, kFunctionKind, 10> {};
7760 7773
7761 class DeoptCountBits : public BitField<int, 0, 4> {}; 7774 class DeoptCountBits : public BitField<int, 0, 4> {};
7762 class OptReenableTriesBits : public BitField<int, 4, 18> {}; 7775 class OptReenableTriesBits : public BitField<int, 4, 18> {};
7763 class ICAgeBits : public BitField<int, 22, 8> {}; 7776 class ICAgeBits : public BitField<int, 22, 8> {};
7764 7777
7765 class OptCountBits : public BitField<int, 0, 22> {}; 7778 class OptCountBits : public BitField<int, 0, 22> {};
(...skipping 3717 matching lines...) Expand 10 before | Expand all | Expand 10 after
11483 }; 11496 };
11484 11497
11485 11498
11486 // The DebugInfo class holds additional information for a function being 11499 // The DebugInfo class holds additional information for a function being
11487 // debugged. 11500 // debugged.
11488 class DebugInfo: public Struct { 11501 class DebugInfo: public Struct {
11489 public: 11502 public:
11490 // The shared function info for the source being debugged. 11503 // The shared function info for the source being debugged.
11491 DECL_ACCESSORS(shared, SharedFunctionInfo) 11504 DECL_ACCESSORS(shared, SharedFunctionInfo)
11492 11505
11506 // Bit field containing various information collected for debugging.
11507 DECL_INT_ACCESSORS(debugger_hints)
11508
11493 DECL_ACCESSORS(debug_bytecode_array, Object) 11509 DECL_ACCESSORS(debug_bytecode_array, Object)
11494 // Fixed array holding status information for each active break point. 11510 // Fixed array holding status information for each active break point.
11495 DECL_ACCESSORS(break_points, FixedArray) 11511 DECL_ACCESSORS(break_points, FixedArray)
11496 11512
11497 // Check if there is a break point at a source position. 11513 // Check if there is a break point at a source position.
11498 bool HasBreakPoint(int source_position); 11514 bool HasBreakPoint(int source_position);
11499 // Attempt to clear a break point. Return true if successful. 11515 // Attempt to clear a break point. Return true if successful.
11500 static bool ClearBreakPoint(Handle<DebugInfo> debug_info, 11516 static bool ClearBreakPoint(Handle<DebugInfo> debug_info,
11501 Handle<Object> break_point_object); 11517 Handle<Object> break_point_object);
11502 // Set a break point. 11518 // Set a break point.
11503 static void SetBreakPoint(Handle<DebugInfo> debug_info, int source_position, 11519 static void SetBreakPoint(Handle<DebugInfo> debug_info, int source_position,
11504 Handle<Object> break_point_object); 11520 Handle<Object> break_point_object);
11505 // Get the break point objects for a source position. 11521 // Get the break point objects for a source position.
11506 Handle<Object> GetBreakPointObjects(int source_position); 11522 Handle<Object> GetBreakPointObjects(int source_position);
11507 // Find the break point info holding this break point object. 11523 // Find the break point info holding this break point object.
11508 static Handle<Object> FindBreakPointInfo(Handle<DebugInfo> debug_info, 11524 static Handle<Object> FindBreakPointInfo(Handle<DebugInfo> debug_info,
11509 Handle<Object> break_point_object); 11525 Handle<Object> break_point_object);
11510 // Get the number of break points for this function. 11526 // Get the number of break points for this function.
11511 int GetBreakPointCount(); 11527 int GetBreakPointCount();
11512 11528
11513 static Smi* uninitialized() { return Smi::kZero; }
11514
11515 inline bool HasDebugBytecodeArray(); 11529 inline bool HasDebugBytecodeArray();
11516 inline bool HasDebugCode(); 11530 inline bool HasDebugCode();
11517 11531
11518 inline BytecodeArray* OriginalBytecodeArray(); 11532 inline BytecodeArray* OriginalBytecodeArray();
11519 inline BytecodeArray* DebugBytecodeArray(); 11533 inline BytecodeArray* DebugBytecodeArray();
11520 inline Code* DebugCode(); 11534 inline Code* DebugCode();
11521 11535
11522 DECLARE_CAST(DebugInfo) 11536 DECLARE_CAST(DebugInfo)
11523 11537
11524 // Dispatched behavior. 11538 // Dispatched behavior.
11525 DECLARE_PRINTER(DebugInfo) 11539 DECLARE_PRINTER(DebugInfo)
11526 DECLARE_VERIFIER(DebugInfo) 11540 DECLARE_VERIFIER(DebugInfo)
11527 11541
11528 static const int kSharedFunctionInfoIndex = Struct::kHeaderSize; 11542 static const int kSharedFunctionInfoIndex = Struct::kHeaderSize;
11543 static const int kDebuggerHintsIndex =
11544 kSharedFunctionInfoIndex + kPointerSize;
11529 static const int kDebugBytecodeArrayIndex = 11545 static const int kDebugBytecodeArrayIndex =
11530 kSharedFunctionInfoIndex + kPointerSize; 11546 kDebuggerHintsIndex + kPointerSize;
11531 static const int kBreakPointsStateIndex = 11547 static const int kBreakPointsStateIndex =
11532 kDebugBytecodeArrayIndex + kPointerSize; 11548 kDebugBytecodeArrayIndex + kPointerSize;
11533 static const int kSize = kBreakPointsStateIndex + kPointerSize; 11549 static const int kSize = kBreakPointsStateIndex + kPointerSize;
11534 11550
11535 static const int kEstimatedNofBreakPointsInFunction = 4; 11551 static const int kEstimatedNofBreakPointsInFunction = 4;
11536 11552
11537 private: 11553 private:
11538 // Get the break point info object for a source position. 11554 // Get the break point info object for a source position.
11539 Object* GetBreakPointInfo(int source_position); 11555 Object* GetBreakPointInfo(int source_position);
11540 11556
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
11697 } 11713 }
11698 }; 11714 };
11699 11715
11700 11716
11701 } // NOLINT, false-positive due to second-order macros. 11717 } // NOLINT, false-positive due to second-order macros.
11702 } // NOLINT, false-positive due to second-order macros. 11718 } // NOLINT, false-positive due to second-order macros.
11703 11719
11704 #include "src/objects/object-macros-undef.h" 11720 #include "src/objects/object-macros-undef.h"
11705 11721
11706 #endif // V8_OBJECTS_H_ 11722 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/ia32/macro-assembler-ia32.h ('k') | src/objects-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698