| 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 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| (...skipping 5168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5179 // [start_position_and_type]: Field used to store both the source code | 5179 // [start_position_and_type]: Field used to store both the source code |
| 5180 // position, whether or not the function is a function expression, | 5180 // position, whether or not the function is a function expression, |
| 5181 // and whether or not the function is a toplevel function. The two | 5181 // and whether or not the function is a toplevel function. The two |
| 5182 // least significants bit indicates whether the function is an | 5182 // least significants bit indicates whether the function is an |
| 5183 // expression and the rest contains the source code position. | 5183 // expression and the rest contains the source code position. |
| 5184 inline int start_position_and_type() const; | 5184 inline int start_position_and_type() const; |
| 5185 inline void set_start_position_and_type(int value); | 5185 inline void set_start_position_and_type(int value); |
| 5186 | 5186 |
| 5187 // The function is subject to debugging if a debug info is attached. | 5187 // The function is subject to debugging if a debug info is attached. |
| 5188 inline bool HasDebugInfo() const; | 5188 inline bool HasDebugInfo() const; |
| 5189 inline DebugInfo* GetDebugInfo() const; | 5189 DebugInfo* GetDebugInfo() const; |
| 5190 | 5190 |
| 5191 // A function has debug code if the compiled code has debug break slots. | 5191 // A function has debug code if the compiled code has debug break slots. |
| 5192 inline bool HasDebugCode() const; | 5192 inline bool HasDebugCode() const; |
| 5193 | 5193 |
| 5194 // [debug info]: Debug information. | 5194 // [debug info]: Debug information. |
| 5195 DECL_ACCESSORS(debug_info, Object) | 5195 DECL_ACCESSORS(debug_info, Object) |
| 5196 | 5196 |
| 5197 // Bit field containing various information collected for debugging. | 5197 // Bit field containing various information collected for debugging. |
| 5198 // This field is either stored on the kDebugInfo slot or inside the | 5198 // This field is either stored on the kDebugInfo slot or inside the |
| 5199 // debug info struct. | 5199 // debug info struct. |
| 5200 inline int debugger_hints() const; | 5200 int debugger_hints() const; |
| 5201 inline void set_debugger_hints(int value); | 5201 void set_debugger_hints(int value); |
| 5202 | 5202 |
| 5203 // Indicates that the function was created by the Function function. | 5203 // Indicates that the function was created by the Function function. |
| 5204 // Though it's anonymous, toString should treat it as if it had the name | 5204 // Though it's anonymous, toString should treat it as if it had the name |
| 5205 // "anonymous". We don't set the name itself so that the system does not | 5205 // "anonymous". We don't set the name itself so that the system does not |
| 5206 // see a binding for it. | 5206 // see a binding for it. |
| 5207 DECL_BOOLEAN_ACCESSORS(name_should_print_as_anonymous) | 5207 DECL_BOOLEAN_ACCESSORS(name_should_print_as_anonymous) |
| 5208 | 5208 |
| 5209 // Indicates that the function is either an anonymous expression | 5209 // Indicates that the function is either an anonymous expression |
| 5210 // or an arrow function (the name field can be set through the API, | 5210 // or an arrow function (the name field can be set through the API, |
| 5211 // which does not change this flag). | 5211 // which does not change this flag). |
| (...skipping 3996 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9208 // Starting from given object template's constructor walk up the inheritance | 9208 // Starting from given object template's constructor walk up the inheritance |
| 9209 // chain till a function template that has an instance template is found. | 9209 // chain till a function template that has an instance template is found. |
| 9210 inline ObjectTemplateInfo* GetParent(Isolate* isolate); | 9210 inline ObjectTemplateInfo* GetParent(Isolate* isolate); |
| 9211 | 9211 |
| 9212 private: | 9212 private: |
| 9213 class IsImmutablePrototype : public BitField<bool, 0, 1> {}; | 9213 class IsImmutablePrototype : public BitField<bool, 0, 1> {}; |
| 9214 class EmbedderFieldCount | 9214 class EmbedderFieldCount |
| 9215 : public BitField<int, IsImmutablePrototype::kNext, 29> {}; | 9215 : public BitField<int, IsImmutablePrototype::kNext, 29> {}; |
| 9216 }; | 9216 }; |
| 9217 | 9217 |
| 9218 | |
| 9219 // The DebugInfo class holds additional information for a function being | |
| 9220 // debugged. | |
| 9221 class DebugInfo: public Struct { | |
| 9222 public: | |
| 9223 // The shared function info for the source being debugged. | |
| 9224 DECL_ACCESSORS(shared, SharedFunctionInfo) | |
| 9225 | |
| 9226 // Bit field containing various information collected for debugging. | |
| 9227 DECL_INT_ACCESSORS(debugger_hints) | |
| 9228 | |
| 9229 DECL_ACCESSORS(debug_bytecode_array, Object) | |
| 9230 // Fixed array holding status information for each active break point. | |
| 9231 DECL_ACCESSORS(break_points, FixedArray) | |
| 9232 | |
| 9233 // Check if there is a break point at a source position. | |
| 9234 bool HasBreakPoint(int source_position); | |
| 9235 // Attempt to clear a break point. Return true if successful. | |
| 9236 static bool ClearBreakPoint(Handle<DebugInfo> debug_info, | |
| 9237 Handle<Object> break_point_object); | |
| 9238 // Set a break point. | |
| 9239 static void SetBreakPoint(Handle<DebugInfo> debug_info, int source_position, | |
| 9240 Handle<Object> break_point_object); | |
| 9241 // Get the break point objects for a source position. | |
| 9242 Handle<Object> GetBreakPointObjects(int source_position); | |
| 9243 // Find the break point info holding this break point object. | |
| 9244 static Handle<Object> FindBreakPointInfo(Handle<DebugInfo> debug_info, | |
| 9245 Handle<Object> break_point_object); | |
| 9246 // Get the number of break points for this function. | |
| 9247 int GetBreakPointCount(); | |
| 9248 | |
| 9249 inline bool HasDebugBytecodeArray(); | |
| 9250 inline bool HasDebugCode(); | |
| 9251 | |
| 9252 inline BytecodeArray* OriginalBytecodeArray(); | |
| 9253 inline BytecodeArray* DebugBytecodeArray(); | |
| 9254 inline Code* DebugCode(); | |
| 9255 | |
| 9256 DECLARE_CAST(DebugInfo) | |
| 9257 | |
| 9258 // Dispatched behavior. | |
| 9259 DECLARE_PRINTER(DebugInfo) | |
| 9260 DECLARE_VERIFIER(DebugInfo) | |
| 9261 | |
| 9262 static const int kSharedFunctionInfoIndex = Struct::kHeaderSize; | |
| 9263 static const int kDebuggerHintsIndex = | |
| 9264 kSharedFunctionInfoIndex + kPointerSize; | |
| 9265 static const int kDebugBytecodeArrayIndex = | |
| 9266 kDebuggerHintsIndex + kPointerSize; | |
| 9267 static const int kBreakPointsStateIndex = | |
| 9268 kDebugBytecodeArrayIndex + kPointerSize; | |
| 9269 static const int kSize = kBreakPointsStateIndex + kPointerSize; | |
| 9270 | |
| 9271 static const int kEstimatedNofBreakPointsInFunction = 4; | |
| 9272 | |
| 9273 private: | |
| 9274 // Get the break point info object for a source position. | |
| 9275 Object* GetBreakPointInfo(int source_position); | |
| 9276 | |
| 9277 DISALLOW_IMPLICIT_CONSTRUCTORS(DebugInfo); | |
| 9278 }; | |
| 9279 | |
| 9280 | |
| 9281 // The BreakPointInfo class holds information for break points set in a | |
| 9282 // function. The DebugInfo object holds a BreakPointInfo object for each code | |
| 9283 // position with one or more break points. | |
| 9284 class BreakPointInfo : public Tuple2 { | |
| 9285 public: | |
| 9286 // The position in the source for the break position. | |
| 9287 DECL_INT_ACCESSORS(source_position) | |
| 9288 // List of related JavaScript break points. | |
| 9289 DECL_ACCESSORS(break_point_objects, Object) | |
| 9290 | |
| 9291 // Removes a break point. | |
| 9292 static void ClearBreakPoint(Handle<BreakPointInfo> info, | |
| 9293 Handle<Object> break_point_object); | |
| 9294 // Set a break point. | |
| 9295 static void SetBreakPoint(Handle<BreakPointInfo> info, | |
| 9296 Handle<Object> break_point_object); | |
| 9297 // Check if break point info has this break point object. | |
| 9298 static bool HasBreakPointObject(Handle<BreakPointInfo> info, | |
| 9299 Handle<Object> break_point_object); | |
| 9300 // Get the number of break points for this code offset. | |
| 9301 int GetBreakPointCount(); | |
| 9302 | |
| 9303 int GetStatementPosition(Handle<DebugInfo> debug_info); | |
| 9304 | |
| 9305 DECLARE_CAST(BreakPointInfo) | |
| 9306 | |
| 9307 static const int kSourcePositionIndex = kValue1Offset; | |
| 9308 static const int kBreakPointObjectsIndex = kValue2Offset; | |
| 9309 | |
| 9310 private: | |
| 9311 DISALLOW_IMPLICIT_CONSTRUCTORS(BreakPointInfo); | |
| 9312 }; | |
| 9313 | |
| 9314 class StackFrameInfo : public Struct { | 9218 class StackFrameInfo : public Struct { |
| 9315 public: | 9219 public: |
| 9316 DECL_INT_ACCESSORS(line_number) | 9220 DECL_INT_ACCESSORS(line_number) |
| 9317 DECL_INT_ACCESSORS(column_number) | 9221 DECL_INT_ACCESSORS(column_number) |
| 9318 DECL_INT_ACCESSORS(script_id) | 9222 DECL_INT_ACCESSORS(script_id) |
| 9319 DECL_ACCESSORS(script_name, Object) | 9223 DECL_ACCESSORS(script_name, Object) |
| 9320 DECL_ACCESSORS(script_name_or_source_url, Object) | 9224 DECL_ACCESSORS(script_name_or_source_url, Object) |
| 9321 DECL_ACCESSORS(function_name, Object) | 9225 DECL_ACCESSORS(function_name, Object) |
| 9322 DECL_BOOLEAN_ACCESSORS(is_eval) | 9226 DECL_BOOLEAN_ACCESSORS(is_eval) |
| 9323 DECL_BOOLEAN_ACCESSORS(is_constructor) | 9227 DECL_BOOLEAN_ACCESSORS(is_constructor) |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9443 } | 9347 } |
| 9444 }; | 9348 }; |
| 9445 | 9349 |
| 9446 | 9350 |
| 9447 } // NOLINT, false-positive due to second-order macros. | 9351 } // NOLINT, false-positive due to second-order macros. |
| 9448 } // NOLINT, false-positive due to second-order macros. | 9352 } // NOLINT, false-positive due to second-order macros. |
| 9449 | 9353 |
| 9450 #include "src/objects/object-macros-undef.h" | 9354 #include "src/objects/object-macros-undef.h" |
| 9451 | 9355 |
| 9452 #endif // V8_OBJECTS_H_ | 9356 #endif // V8_OBJECTS_H_ |
| OLD | NEW |