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

Side by Side Diff: src/objects.h

Issue 9836091: Reset function info counters after context disposal. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address comment Created 8 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « src/mark-compact.cc ('k') | src/objects.cc » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 4405 matching lines...) Expand 10 before | Expand all | Expand 10 after
4416 inline void CodeIterateBody(Heap* heap); 4416 inline void CodeIterateBody(Heap* heap);
4417 #ifdef OBJECT_PRINT 4417 #ifdef OBJECT_PRINT
4418 inline void CodePrint() { 4418 inline void CodePrint() {
4419 CodePrint(stdout); 4419 CodePrint(stdout);
4420 } 4420 }
4421 void CodePrint(FILE* out); 4421 void CodePrint(FILE* out);
4422 #endif 4422 #endif
4423 #ifdef DEBUG 4423 #ifdef DEBUG
4424 void CodeVerify(); 4424 void CodeVerify();
4425 #endif 4425 #endif
4426 void ClearInlineCaches();
4426 4427
4427 // Max loop nesting marker used to postpose OSR. We don't take loop 4428 // Max loop nesting marker used to postpose OSR. We don't take loop
4428 // nesting that is deeper than 5 levels into account. 4429 // nesting that is deeper than 5 levels into account.
4429 static const int kMaxLoopNestingMarker = 6; 4430 static const int kMaxLoopNestingMarker = 6;
4430 4431
4431 // Layout description. 4432 // Layout description.
4432 static const int kInstructionSizeOffset = HeapObject::kHeaderSize; 4433 static const int kInstructionSizeOffset = HeapObject::kHeaderSize;
4433 static const int kRelocationInfoOffset = kInstructionSizeOffset + kIntSize; 4434 static const int kRelocationInfoOffset = kInstructionSizeOffset + kIntSize;
4434 static const int kHandlerTableOffset = kRelocationInfoOffset + kPointerSize; 4435 static const int kHandlerTableOffset = kRelocationInfoOffset + kPointerSize;
4435 static const int kDeoptimizationDataOffset = 4436 static const int kDeoptimizationDataOffset =
(...skipping 880 matching lines...) Expand 10 before | Expand all | Expand 10 after
5316 DECL_BOOLEAN_ACCESSORS(is_expression) 5317 DECL_BOOLEAN_ACCESSORS(is_expression)
5317 5318
5318 // Is this function a top-level function (scripts, evals). 5319 // Is this function a top-level function (scripts, evals).
5319 DECL_BOOLEAN_ACCESSORS(is_toplevel) 5320 DECL_BOOLEAN_ACCESSORS(is_toplevel)
5320 5321
5321 // Bit field containing various information collected by the compiler to 5322 // Bit field containing various information collected by the compiler to
5322 // drive optimization. 5323 // drive optimization.
5323 inline int compiler_hints(); 5324 inline int compiler_hints();
5324 inline void set_compiler_hints(int value); 5325 inline void set_compiler_hints(int value);
5325 5326
5327 inline int ast_node_count();
5328 inline void set_ast_node_count(int count);
5329
5326 // A counter used to determine when to stress the deoptimizer with a 5330 // A counter used to determine when to stress the deoptimizer with a
5327 // deopt. 5331 // deopt.
5328 inline int deopt_counter(); 5332 inline int deopt_counter();
5329 inline void set_deopt_counter(int counter); 5333 inline void set_deopt_counter(int counter);
5330 5334
5331 inline int profiler_ticks(); 5335 inline int profiler_ticks();
5332 inline void set_profiler_ticks(int ticks); 5336 inline void set_profiler_ticks(int ticks);
5333 5337
5334 inline int ast_node_count(); 5338 // Inline cache age is used to infer whether the function survived a context
5335 inline void set_ast_node_count(int count); 5339 // disposal or not. In the former case we reset the opt_count.
5340 inline int ic_age();
5341 inline void set_ic_age(int age);
5336 5342
5337 // Add information on assignments of the form this.x = ...; 5343 // Add information on assignments of the form this.x = ...;
5338 void SetThisPropertyAssignmentsInfo( 5344 void SetThisPropertyAssignmentsInfo(
5339 bool has_only_simple_this_property_assignments, 5345 bool has_only_simple_this_property_assignments,
5340 FixedArray* this_property_assignments); 5346 FixedArray* this_property_assignments);
5341 5347
5342 // Clear information on assignments of the form this.x = ...; 5348 // Clear information on assignments of the form this.x = ...;
5343 void ClearThisPropertyAssignmentsInfo(); 5349 void ClearThisPropertyAssignmentsInfo();
5344 5350
5345 // Indicate that this function only consists of assignments of the form 5351 // Indicate that this function only consists of assignments of the form
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
5471 #ifdef OBJECT_PRINT 5477 #ifdef OBJECT_PRINT
5472 inline void SharedFunctionInfoPrint() { 5478 inline void SharedFunctionInfoPrint() {
5473 SharedFunctionInfoPrint(stdout); 5479 SharedFunctionInfoPrint(stdout);
5474 } 5480 }
5475 void SharedFunctionInfoPrint(FILE* out); 5481 void SharedFunctionInfoPrint(FILE* out);
5476 #endif 5482 #endif
5477 #ifdef DEBUG 5483 #ifdef DEBUG
5478 void SharedFunctionInfoVerify(); 5484 void SharedFunctionInfoVerify();
5479 #endif 5485 #endif
5480 5486
5487 void ResetForNewContext(int new_ic_age);
5488
5481 // Helpers to compile the shared code. Returns true on success, false on 5489 // Helpers to compile the shared code. Returns true on success, false on
5482 // failure (e.g., stack overflow during compilation). 5490 // failure (e.g., stack overflow during compilation).
5483 static bool EnsureCompiled(Handle<SharedFunctionInfo> shared, 5491 static bool EnsureCompiled(Handle<SharedFunctionInfo> shared,
5484 ClearExceptionFlag flag); 5492 ClearExceptionFlag flag);
5485 static bool CompileLazy(Handle<SharedFunctionInfo> shared, 5493 static bool CompileLazy(Handle<SharedFunctionInfo> shared,
5486 ClearExceptionFlag flag); 5494 ClearExceptionFlag flag);
5487 5495
5488 // Casting. 5496 // Casting.
5489 static inline SharedFunctionInfo* cast(Object* obj); 5497 static inline SharedFunctionInfo* cast(Object* obj);
5490 5498
(...skipping 10 matching lines...) Expand all
5501 kConstructStubOffset + kPointerSize; 5509 kConstructStubOffset + kPointerSize;
5502 static const int kFunctionDataOffset = 5510 static const int kFunctionDataOffset =
5503 kInstanceClassNameOffset + kPointerSize; 5511 kInstanceClassNameOffset + kPointerSize;
5504 static const int kScriptOffset = kFunctionDataOffset + kPointerSize; 5512 static const int kScriptOffset = kFunctionDataOffset + kPointerSize;
5505 static const int kDebugInfoOffset = kScriptOffset + kPointerSize; 5513 static const int kDebugInfoOffset = kScriptOffset + kPointerSize;
5506 static const int kInferredNameOffset = kDebugInfoOffset + kPointerSize; 5514 static const int kInferredNameOffset = kDebugInfoOffset + kPointerSize;
5507 static const int kInitialMapOffset = 5515 static const int kInitialMapOffset =
5508 kInferredNameOffset + kPointerSize; 5516 kInferredNameOffset + kPointerSize;
5509 static const int kThisPropertyAssignmentsOffset = 5517 static const int kThisPropertyAssignmentsOffset =
5510 kInitialMapOffset + kPointerSize; 5518 kInitialMapOffset + kPointerSize;
5511 static const int kProfilerTicksOffset =
5512 kThisPropertyAssignmentsOffset + kPointerSize;
5513 #if V8_HOST_ARCH_32_BIT 5519 #if V8_HOST_ARCH_32_BIT
5514 // Smi fields. 5520 // Smi fields.
5515 static const int kLengthOffset = 5521 static const int kLengthOffset =
5516 kProfilerTicksOffset + kPointerSize; 5522 kThisPropertyAssignmentsOffset + kPointerSize;
5517 static const int kFormalParameterCountOffset = kLengthOffset + kPointerSize; 5523 static const int kFormalParameterCountOffset = kLengthOffset + kPointerSize;
5518 static const int kExpectedNofPropertiesOffset = 5524 static const int kExpectedNofPropertiesOffset =
5519 kFormalParameterCountOffset + kPointerSize; 5525 kFormalParameterCountOffset + kPointerSize;
5520 static const int kNumLiteralsOffset = 5526 static const int kNumLiteralsOffset =
5521 kExpectedNofPropertiesOffset + kPointerSize; 5527 kExpectedNofPropertiesOffset + kPointerSize;
5522 static const int kStartPositionAndTypeOffset = 5528 static const int kStartPositionAndTypeOffset =
5523 kNumLiteralsOffset + kPointerSize; 5529 kNumLiteralsOffset + kPointerSize;
5524 static const int kEndPositionOffset = 5530 static const int kEndPositionOffset =
5525 kStartPositionAndTypeOffset + kPointerSize; 5531 kStartPositionAndTypeOffset + kPointerSize;
5526 static const int kFunctionTokenPositionOffset = 5532 static const int kFunctionTokenPositionOffset =
5527 kEndPositionOffset + kPointerSize; 5533 kEndPositionOffset + kPointerSize;
5528 static const int kCompilerHintsOffset = 5534 static const int kCompilerHintsOffset =
5529 kFunctionTokenPositionOffset + kPointerSize; 5535 kFunctionTokenPositionOffset + kPointerSize;
5530 static const int kThisPropertyAssignmentsCountOffset = 5536 static const int kThisPropertyAssignmentsCountOffset =
5531 kCompilerHintsOffset + kPointerSize; 5537 kCompilerHintsOffset + kPointerSize;
5532 static const int kOptCountOffset = 5538 static const int kOptCountOffset =
5533 kThisPropertyAssignmentsCountOffset + kPointerSize; 5539 kThisPropertyAssignmentsCountOffset + kPointerSize;
5534 static const int kAstNodeCountOffset = kOptCountOffset + kPointerSize; 5540 static const int kAstNodeCountOffset = kOptCountOffset + kPointerSize;
5535 static const int kDeoptCounterOffset = 5541 static const int kDeoptCounterOffset = kAstNodeCountOffset + kPointerSize;
5536 kAstNodeCountOffset + kPointerSize; 5542 static const int kProfilerTicksOffset = kDeoptCounterOffset + kPointerSize;
5543 static const int kICAgeOffset = kProfilerTicksOffset + kPointerSize;
5544
5537 // Total size. 5545 // Total size.
5538 static const int kSize = kDeoptCounterOffset + kPointerSize; 5546 static const int kSize = kICAgeOffset + kPointerSize;
5539 #else 5547 #else
5540 // The only reason to use smi fields instead of int fields 5548 // The only reason to use smi fields instead of int fields
5541 // is to allow iteration without maps decoding during 5549 // is to allow iteration without maps decoding during
5542 // garbage collections. 5550 // garbage collections.
5543 // To avoid wasting space on 64-bit architectures we use 5551 // To avoid wasting space on 64-bit architectures we use
5544 // the following trick: we group integer fields into pairs 5552 // the following trick: we group integer fields into pairs
5545 // First integer in each pair is shifted left by 1. 5553 // First integer in each pair is shifted left by 1.
5546 // By doing this we guarantee that LSB of each kPointerSize aligned 5554 // By doing this we guarantee that LSB of each kPointerSize aligned
5547 // word is not set and thus this word cannot be treated as pointer 5555 // word is not set and thus this word cannot be treated as pointer
5548 // to HeapObject during old space traversal. 5556 // to HeapObject during old space traversal.
5549 static const int kLengthOffset = 5557 static const int kLengthOffset =
5550 kProfilerTicksOffset + kPointerSize; 5558 kThisPropertyAssignmentsOffset + kPointerSize;
5551 static const int kFormalParameterCountOffset = 5559 static const int kFormalParameterCountOffset =
5552 kLengthOffset + kIntSize; 5560 kLengthOffset + kIntSize;
5553 5561
5554 static const int kExpectedNofPropertiesOffset = 5562 static const int kExpectedNofPropertiesOffset =
5555 kFormalParameterCountOffset + kIntSize; 5563 kFormalParameterCountOffset + kIntSize;
5556 static const int kNumLiteralsOffset = 5564 static const int kNumLiteralsOffset =
5557 kExpectedNofPropertiesOffset + kIntSize; 5565 kExpectedNofPropertiesOffset + kIntSize;
5558 5566
5559 static const int kEndPositionOffset = 5567 static const int kEndPositionOffset =
5560 kNumLiteralsOffset + kIntSize; 5568 kNumLiteralsOffset + kIntSize;
5561 static const int kStartPositionAndTypeOffset = 5569 static const int kStartPositionAndTypeOffset =
5562 kEndPositionOffset + kIntSize; 5570 kEndPositionOffset + kIntSize;
5563 5571
5564 static const int kFunctionTokenPositionOffset = 5572 static const int kFunctionTokenPositionOffset =
5565 kStartPositionAndTypeOffset + kIntSize; 5573 kStartPositionAndTypeOffset + kIntSize;
5566 static const int kCompilerHintsOffset = 5574 static const int kCompilerHintsOffset =
5567 kFunctionTokenPositionOffset + kIntSize; 5575 kFunctionTokenPositionOffset + kIntSize;
5568 5576
5569 static const int kThisPropertyAssignmentsCountOffset = 5577 static const int kThisPropertyAssignmentsCountOffset =
5570 kCompilerHintsOffset + kIntSize; 5578 kCompilerHintsOffset + kIntSize;
5571 static const int kOptCountOffset = 5579 static const int kOptCountOffset =
5572 kThisPropertyAssignmentsCountOffset + kIntSize; 5580 kThisPropertyAssignmentsCountOffset + kIntSize;
5573 5581
5574 static const int kAstNodeCountOffset = kOptCountOffset + kIntSize; 5582 static const int kAstNodeCountOffset = kOptCountOffset + kIntSize;
5575 static const int kDeoptCounterOffset = kAstNodeCountOffset + kIntSize; 5583 static const int kDeoptCounterOffset = kAstNodeCountOffset + kIntSize;
5576 5584
5585
5586 static const int kProfilerTicksOffset = kDeoptCounterOffset + kIntSize;
5587 static const int kICAgeOffset = kProfilerTicksOffset + kIntSize;
5588
5577 // Total size. 5589 // Total size.
5578 static const int kSize = kDeoptCounterOffset + kIntSize; 5590 static const int kSize = kICAgeOffset + kIntSize;
5579 5591
5580 #endif 5592 #endif
5581 5593
5582 // The construction counter for inobject slack tracking is stored in the 5594 // The construction counter for inobject slack tracking is stored in the
5583 // most significant byte of compiler_hints which is otherwise unused. 5595 // most significant byte of compiler_hints which is otherwise unused.
5584 // Its offset depends on the endian-ness of the architecture. 5596 // Its offset depends on the endian-ness of the architecture.
5585 #if __BYTE_ORDER == __LITTLE_ENDIAN 5597 #if __BYTE_ORDER == __LITTLE_ENDIAN
5586 static const int kConstructionCountOffset = kCompilerHintsOffset + 3; 5598 static const int kConstructionCountOffset = kCompilerHintsOffset + 3;
5587 #elif __BYTE_ORDER == __BIG_ENDIAN 5599 #elif __BYTE_ORDER == __BIG_ENDIAN
5588 static const int kConstructionCountOffset = kCompilerHintsOffset + 0; 5600 static const int kConstructionCountOffset = kCompilerHintsOffset + 0;
(...skipping 2994 matching lines...) Expand 10 before | Expand all | Expand 10 after
8583 } else { 8595 } else {
8584 value &= ~(1 << bit_position); 8596 value &= ~(1 << bit_position);
8585 } 8597 }
8586 return value; 8598 return value;
8587 } 8599 }
8588 }; 8600 };
8589 8601
8590 } } // namespace v8::internal 8602 } } // namespace v8::internal
8591 8603
8592 #endif // V8_OBJECTS_H_ 8604 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/mark-compact.cc ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698