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

Side by Side Diff: src/objects.h

Issue 10041025: Merged r11143, r11162, r11174, r11208, r11213, r11222 into 3.9 branch. (Closed) Base URL: https://v8.googlecode.com/svn/branches/3.9
Patch Set: Created 8 years, 8 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 4237 matching lines...) Expand 10 before | Expand all | Expand 10 after
4248 inline bool has_self_optimization_header(); 4248 inline bool has_self_optimization_header();
4249 inline void set_self_optimization_header(bool value); 4249 inline void set_self_optimization_header(bool value);
4250 4250
4251 // [allow_osr_at_loop_nesting_level]: For FUNCTION kind, tells for 4251 // [allow_osr_at_loop_nesting_level]: For FUNCTION kind, tells for
4252 // how long the function has been marked for OSR and therefore which 4252 // how long the function has been marked for OSR and therefore which
4253 // level of loop nesting we are willing to do on-stack replacement 4253 // level of loop nesting we are willing to do on-stack replacement
4254 // for. 4254 // for.
4255 inline void set_allow_osr_at_loop_nesting_level(int level); 4255 inline void set_allow_osr_at_loop_nesting_level(int level);
4256 inline int allow_osr_at_loop_nesting_level(); 4256 inline int allow_osr_at_loop_nesting_level();
4257 4257
4258 // [profiler_ticks]: For FUNCTION kind, tells for how many profiler ticks
4259 // the code object was seen on the stack with no IC patching going on.
4260 inline int profiler_ticks();
4261 inline void set_profiler_ticks(int ticks);
4262
4258 // [stack_slots]: For kind OPTIMIZED_FUNCTION, the number of stack slots 4263 // [stack_slots]: For kind OPTIMIZED_FUNCTION, the number of stack slots
4259 // reserved in the code prologue. 4264 // reserved in the code prologue.
4260 inline unsigned stack_slots(); 4265 inline unsigned stack_slots();
4261 inline void set_stack_slots(unsigned slots); 4266 inline void set_stack_slots(unsigned slots);
4262 4267
4263 // [safepoint_table_start]: For kind OPTIMIZED_CODE, the offset in 4268 // [safepoint_table_start]: For kind OPTIMIZED_CODE, the offset in
4264 // the instruction stream where the safepoint table starts. 4269 // the instruction stream where the safepoint table starts.
4265 inline unsigned safepoint_table_offset(); 4270 inline unsigned safepoint_table_offset();
4266 inline void set_safepoint_table_offset(unsigned offset); 4271 inline void set_safepoint_table_offset(unsigned offset);
4267 4272
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
4416 inline void CodeIterateBody(Heap* heap); 4421 inline void CodeIterateBody(Heap* heap);
4417 #ifdef OBJECT_PRINT 4422 #ifdef OBJECT_PRINT
4418 inline void CodePrint() { 4423 inline void CodePrint() {
4419 CodePrint(stdout); 4424 CodePrint(stdout);
4420 } 4425 }
4421 void CodePrint(FILE* out); 4426 void CodePrint(FILE* out);
4422 #endif 4427 #endif
4423 #ifdef DEBUG 4428 #ifdef DEBUG
4424 void CodeVerify(); 4429 void CodeVerify();
4425 #endif 4430 #endif
4431 void ClearInlineCaches();
4426 4432
4427 // Max loop nesting marker used to postpose OSR. We don't take loop 4433 // Max loop nesting marker used to postpose OSR. We don't take loop
4428 // nesting that is deeper than 5 levels into account. 4434 // nesting that is deeper than 5 levels into account.
4429 static const int kMaxLoopNestingMarker = 6; 4435 static const int kMaxLoopNestingMarker = 6;
4430 4436
4431 // Layout description. 4437 // Layout description.
4432 static const int kInstructionSizeOffset = HeapObject::kHeaderSize; 4438 static const int kInstructionSizeOffset = HeapObject::kHeaderSize;
4433 static const int kRelocationInfoOffset = kInstructionSizeOffset + kIntSize; 4439 static const int kRelocationInfoOffset = kInstructionSizeOffset + kIntSize;
4434 static const int kHandlerTableOffset = kRelocationInfoOffset + kPointerSize; 4440 static const int kHandlerTableOffset = kRelocationInfoOffset + kPointerSize;
4435 static const int kDeoptimizationDataOffset = 4441 static const int kDeoptimizationDataOffset =
(...skipping 30 matching lines...) Expand all
4466 static const int kFullCodeFlags = kOptimizableOffset + 1; 4472 static const int kFullCodeFlags = kOptimizableOffset + 1;
4467 class FullCodeFlagsHasDeoptimizationSupportField: 4473 class FullCodeFlagsHasDeoptimizationSupportField:
4468 public BitField<bool, 0, 1> {}; // NOLINT 4474 public BitField<bool, 0, 1> {}; // NOLINT
4469 class FullCodeFlagsHasDebugBreakSlotsField: public BitField<bool, 1, 1> {}; 4475 class FullCodeFlagsHasDebugBreakSlotsField: public BitField<bool, 1, 1> {};
4470 class FullCodeFlagsIsCompiledOptimizable: public BitField<bool, 2, 1> {}; 4476 class FullCodeFlagsIsCompiledOptimizable: public BitField<bool, 2, 1> {};
4471 class FullCodeFlagsHasSelfOptimizationHeader: public BitField<bool, 3, 1> {}; 4477 class FullCodeFlagsHasSelfOptimizationHeader: public BitField<bool, 3, 1> {};
4472 4478
4473 static const int kBinaryOpReturnTypeOffset = kBinaryOpTypeOffset + 1; 4479 static const int kBinaryOpReturnTypeOffset = kBinaryOpTypeOffset + 1;
4474 4480
4475 static const int kAllowOSRAtLoopNestingLevelOffset = kFullCodeFlags + 1; 4481 static const int kAllowOSRAtLoopNestingLevelOffset = kFullCodeFlags + 1;
4482 static const int kProfilerTicksOffset = kAllowOSRAtLoopNestingLevelOffset + 1;
4476 4483
4477 static const int kSafepointTableOffsetOffset = kStackSlotsOffset + kIntSize; 4484 static const int kSafepointTableOffsetOffset = kStackSlotsOffset + kIntSize;
4478 static const int kStackCheckTableOffsetOffset = kStackSlotsOffset + kIntSize; 4485 static const int kStackCheckTableOffsetOffset = kStackSlotsOffset + kIntSize;
4479 4486
4480 // Flags layout. BitField<type, shift, size>. 4487 // Flags layout. BitField<type, shift, size>.
4481 class ICStateField: public BitField<InlineCacheState, 0, 3> {}; 4488 class ICStateField: public BitField<InlineCacheState, 0, 3> {};
4482 class TypeField: public BitField<PropertyType, 3, 4> {}; 4489 class TypeField: public BitField<PropertyType, 3, 4> {};
4483 class CacheHolderField: public BitField<InlineCacheHolderFlag, 7, 1> {}; 4490 class CacheHolderField: public BitField<InlineCacheHolderFlag, 7, 1> {};
4484 class KindField: public BitField<Kind, 8, 4> {}; 4491 class KindField: public BitField<Kind, 8, 4> {};
4485 class ExtraICStateField: public BitField<ExtraICState, 12, 2> {}; 4492 class ExtraICStateField: public BitField<ExtraICState, 12, 2> {};
(...skipping 830 matching lines...) Expand 10 before | Expand all | Expand 10 after
5316 DECL_BOOLEAN_ACCESSORS(is_expression) 5323 DECL_BOOLEAN_ACCESSORS(is_expression)
5317 5324
5318 // Is this function a top-level function (scripts, evals). 5325 // Is this function a top-level function (scripts, evals).
5319 DECL_BOOLEAN_ACCESSORS(is_toplevel) 5326 DECL_BOOLEAN_ACCESSORS(is_toplevel)
5320 5327
5321 // Bit field containing various information collected by the compiler to 5328 // Bit field containing various information collected by the compiler to
5322 // drive optimization. 5329 // drive optimization.
5323 inline int compiler_hints(); 5330 inline int compiler_hints();
5324 inline void set_compiler_hints(int value); 5331 inline void set_compiler_hints(int value);
5325 5332
5333 inline int ast_node_count();
5334 inline void set_ast_node_count(int count);
5335
5326 // A counter used to determine when to stress the deoptimizer with a 5336 // A counter used to determine when to stress the deoptimizer with a
5327 // deopt. 5337 // deopt.
5328 inline int deopt_counter(); 5338 inline int deopt_counter();
5329 inline void set_deopt_counter(int counter); 5339 inline void set_deopt_counter(int counter);
5330 5340
5331 inline int profiler_ticks(); 5341 // Inline cache age is used to infer whether the function survived a context
5332 inline void set_profiler_ticks(int ticks); 5342 // disposal or not. In the former case we reset the opt_count.
5333 5343 inline int ic_age();
5334 inline int ast_node_count(); 5344 inline void set_ic_age(int age);
5335 inline void set_ast_node_count(int count);
5336 5345
5337 // Add information on assignments of the form this.x = ...; 5346 // Add information on assignments of the form this.x = ...;
5338 void SetThisPropertyAssignmentsInfo( 5347 void SetThisPropertyAssignmentsInfo(
5339 bool has_only_simple_this_property_assignments, 5348 bool has_only_simple_this_property_assignments,
5340 FixedArray* this_property_assignments); 5349 FixedArray* this_property_assignments);
5341 5350
5342 // Clear information on assignments of the form this.x = ...; 5351 // Clear information on assignments of the form this.x = ...;
5343 void ClearThisPropertyAssignmentsInfo(); 5352 void ClearThisPropertyAssignmentsInfo();
5344 5353
5345 // Indicate that this function only consists of assignments of the form 5354 // 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 5480 #ifdef OBJECT_PRINT
5472 inline void SharedFunctionInfoPrint() { 5481 inline void SharedFunctionInfoPrint() {
5473 SharedFunctionInfoPrint(stdout); 5482 SharedFunctionInfoPrint(stdout);
5474 } 5483 }
5475 void SharedFunctionInfoPrint(FILE* out); 5484 void SharedFunctionInfoPrint(FILE* out);
5476 #endif 5485 #endif
5477 #ifdef DEBUG 5486 #ifdef DEBUG
5478 void SharedFunctionInfoVerify(); 5487 void SharedFunctionInfoVerify();
5479 #endif 5488 #endif
5480 5489
5490 void ResetForNewContext(int new_ic_age);
5491
5481 // Helpers to compile the shared code. Returns true on success, false on 5492 // Helpers to compile the shared code. Returns true on success, false on
5482 // failure (e.g., stack overflow during compilation). 5493 // failure (e.g., stack overflow during compilation).
5483 static bool EnsureCompiled(Handle<SharedFunctionInfo> shared, 5494 static bool EnsureCompiled(Handle<SharedFunctionInfo> shared,
5484 ClearExceptionFlag flag); 5495 ClearExceptionFlag flag);
5485 static bool CompileLazy(Handle<SharedFunctionInfo> shared, 5496 static bool CompileLazy(Handle<SharedFunctionInfo> shared,
5486 ClearExceptionFlag flag); 5497 ClearExceptionFlag flag);
5487 5498
5499 void SharedFunctionInfoIterateBody(ObjectVisitor* v);
5500
5488 // Casting. 5501 // Casting.
5489 static inline SharedFunctionInfo* cast(Object* obj); 5502 static inline SharedFunctionInfo* cast(Object* obj);
5490 5503
5491 // Constants. 5504 // Constants.
5492 static const int kDontAdaptArgumentsSentinel = -1; 5505 static const int kDontAdaptArgumentsSentinel = -1;
5493 5506
5494 // Layout description. 5507 // Layout description.
5495 // Pointer fields. 5508 // Pointer fields.
5496 static const int kNameOffset = HeapObject::kHeaderSize; 5509 static const int kNameOffset = HeapObject::kHeaderSize;
5497 static const int kCodeOffset = kNameOffset + kPointerSize; 5510 static const int kCodeOffset = kNameOffset + kPointerSize;
5498 static const int kScopeInfoOffset = kCodeOffset + kPointerSize; 5511 static const int kScopeInfoOffset = kCodeOffset + kPointerSize;
5499 static const int kConstructStubOffset = kScopeInfoOffset + kPointerSize; 5512 static const int kConstructStubOffset = kScopeInfoOffset + kPointerSize;
5500 static const int kInstanceClassNameOffset = 5513 static const int kInstanceClassNameOffset =
5501 kConstructStubOffset + kPointerSize; 5514 kConstructStubOffset + kPointerSize;
5502 static const int kFunctionDataOffset = 5515 static const int kFunctionDataOffset =
5503 kInstanceClassNameOffset + kPointerSize; 5516 kInstanceClassNameOffset + kPointerSize;
5504 static const int kScriptOffset = kFunctionDataOffset + kPointerSize; 5517 static const int kScriptOffset = kFunctionDataOffset + kPointerSize;
5505 static const int kDebugInfoOffset = kScriptOffset + kPointerSize; 5518 static const int kDebugInfoOffset = kScriptOffset + kPointerSize;
5506 static const int kInferredNameOffset = kDebugInfoOffset + kPointerSize; 5519 static const int kInferredNameOffset = kDebugInfoOffset + kPointerSize;
5507 static const int kInitialMapOffset = 5520 static const int kInitialMapOffset =
5508 kInferredNameOffset + kPointerSize; 5521 kInferredNameOffset + kPointerSize;
5509 static const int kThisPropertyAssignmentsOffset = 5522 static const int kThisPropertyAssignmentsOffset =
5510 kInitialMapOffset + kPointerSize; 5523 kInitialMapOffset + kPointerSize;
5511 static const int kProfilerTicksOffset = 5524 // ic_age is a Smi field. It could be grouped with another Smi field into a
5512 kThisPropertyAssignmentsOffset + kPointerSize; 5525 // PSEUDO_SMI_ACCESSORS pair (on x64), if one becomes available.
5526 static const int kICAgeOffset = kThisPropertyAssignmentsOffset + kPointerSize;
5513 #if V8_HOST_ARCH_32_BIT 5527 #if V8_HOST_ARCH_32_BIT
5514 // Smi fields. 5528 // Smi fields.
5515 static const int kLengthOffset = 5529 static const int kLengthOffset =
5516 kProfilerTicksOffset + kPointerSize; 5530 kICAgeOffset + kPointerSize;
5517 static const int kFormalParameterCountOffset = kLengthOffset + kPointerSize; 5531 static const int kFormalParameterCountOffset = kLengthOffset + kPointerSize;
5518 static const int kExpectedNofPropertiesOffset = 5532 static const int kExpectedNofPropertiesOffset =
5519 kFormalParameterCountOffset + kPointerSize; 5533 kFormalParameterCountOffset + kPointerSize;
5520 static const int kNumLiteralsOffset = 5534 static const int kNumLiteralsOffset =
5521 kExpectedNofPropertiesOffset + kPointerSize; 5535 kExpectedNofPropertiesOffset + kPointerSize;
5522 static const int kStartPositionAndTypeOffset = 5536 static const int kStartPositionAndTypeOffset =
5523 kNumLiteralsOffset + kPointerSize; 5537 kNumLiteralsOffset + kPointerSize;
5524 static const int kEndPositionOffset = 5538 static const int kEndPositionOffset =
5525 kStartPositionAndTypeOffset + kPointerSize; 5539 kStartPositionAndTypeOffset + kPointerSize;
5526 static const int kFunctionTokenPositionOffset = 5540 static const int kFunctionTokenPositionOffset =
5527 kEndPositionOffset + kPointerSize; 5541 kEndPositionOffset + kPointerSize;
5528 static const int kCompilerHintsOffset = 5542 static const int kCompilerHintsOffset =
5529 kFunctionTokenPositionOffset + kPointerSize; 5543 kFunctionTokenPositionOffset + kPointerSize;
5530 static const int kThisPropertyAssignmentsCountOffset = 5544 static const int kThisPropertyAssignmentsCountOffset =
5531 kCompilerHintsOffset + kPointerSize; 5545 kCompilerHintsOffset + kPointerSize;
5532 static const int kOptCountOffset = 5546 static const int kOptCountOffset =
5533 kThisPropertyAssignmentsCountOffset + kPointerSize; 5547 kThisPropertyAssignmentsCountOffset + kPointerSize;
5534 static const int kAstNodeCountOffset = kOptCountOffset + kPointerSize; 5548 static const int kAstNodeCountOffset = kOptCountOffset + kPointerSize;
5535 static const int kDeoptCounterOffset = 5549 static const int kDeoptCounterOffset = kAstNodeCountOffset + kPointerSize;
5536 kAstNodeCountOffset + kPointerSize; 5550
5551
5537 // Total size. 5552 // Total size.
5538 static const int kSize = kDeoptCounterOffset + kPointerSize; 5553 static const int kSize = kDeoptCounterOffset + kPointerSize;
5539 #else 5554 #else
5540 // The only reason to use smi fields instead of int fields 5555 // The only reason to use smi fields instead of int fields
5541 // is to allow iteration without maps decoding during 5556 // is to allow iteration without maps decoding during
5542 // garbage collections. 5557 // garbage collections.
5543 // To avoid wasting space on 64-bit architectures we use 5558 // To avoid wasting space on 64-bit architectures we use
5544 // the following trick: we group integer fields into pairs 5559 // the following trick: we group integer fields into pairs
5545 // First integer in each pair is shifted left by 1. 5560 // First integer in each pair is shifted left by 1.
5546 // By doing this we guarantee that LSB of each kPointerSize aligned 5561 // 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 5562 // word is not set and thus this word cannot be treated as pointer
5548 // to HeapObject during old space traversal. 5563 // to HeapObject during old space traversal.
5549 static const int kLengthOffset = 5564 static const int kLengthOffset =
5550 kProfilerTicksOffset + kPointerSize; 5565 kICAgeOffset + kPointerSize;
5551 static const int kFormalParameterCountOffset = 5566 static const int kFormalParameterCountOffset =
5552 kLengthOffset + kIntSize; 5567 kLengthOffset + kIntSize;
5553 5568
5554 static const int kExpectedNofPropertiesOffset = 5569 static const int kExpectedNofPropertiesOffset =
5555 kFormalParameterCountOffset + kIntSize; 5570 kFormalParameterCountOffset + kIntSize;
5556 static const int kNumLiteralsOffset = 5571 static const int kNumLiteralsOffset =
5557 kExpectedNofPropertiesOffset + kIntSize; 5572 kExpectedNofPropertiesOffset + kIntSize;
5558 5573
5559 static const int kEndPositionOffset = 5574 static const int kEndPositionOffset =
5560 kNumLiteralsOffset + kIntSize; 5575 kNumLiteralsOffset + kIntSize;
(...skipping 994 matching lines...) Expand 10 before | Expand all | Expand 10 after
6555 private: 6570 private:
6556 DISALLOW_IMPLICIT_CONSTRUCTORS(PolymorphicCodeCacheHashTable); 6571 DISALLOW_IMPLICIT_CONSTRUCTORS(PolymorphicCodeCacheHashTable);
6557 }; 6572 };
6558 6573
6559 6574
6560 class TypeFeedbackInfo: public Struct { 6575 class TypeFeedbackInfo: public Struct {
6561 public: 6576 public:
6562 inline int ic_total_count(); 6577 inline int ic_total_count();
6563 inline void set_ic_total_count(int count); 6578 inline void set_ic_total_count(int count);
6564 6579
6565 inline int ic_with_typeinfo_count(); 6580 inline int ic_with_type_info_count();
6566 inline void set_ic_with_typeinfo_count(int count); 6581 inline void set_ic_with_type_info_count(int count);
6567 6582
6568 DECL_ACCESSORS(type_feedback_cells, TypeFeedbackCells) 6583 DECL_ACCESSORS(type_feedback_cells, TypeFeedbackCells)
6569 6584
6570 static inline TypeFeedbackInfo* cast(Object* obj); 6585 static inline TypeFeedbackInfo* cast(Object* obj);
6571 6586
6572 #ifdef OBJECT_PRINT 6587 #ifdef OBJECT_PRINT
6573 inline void TypeFeedbackInfoPrint() { 6588 inline void TypeFeedbackInfoPrint() {
6574 TypeFeedbackInfoPrint(stdout); 6589 TypeFeedbackInfoPrint(stdout);
6575 } 6590 }
6576 void TypeFeedbackInfoPrint(FILE* out); 6591 void TypeFeedbackInfoPrint(FILE* out);
(...skipping 1947 matching lines...) Expand 10 before | Expand all | Expand 10 after
8524 8539
8525 // Visits a debug call target in the instruction stream. 8540 // Visits a debug call target in the instruction stream.
8526 virtual void VisitDebugTarget(RelocInfo* rinfo); 8541 virtual void VisitDebugTarget(RelocInfo* rinfo);
8527 8542
8528 // Handy shorthand for visiting a single pointer. 8543 // Handy shorthand for visiting a single pointer.
8529 virtual void VisitPointer(Object** p) { VisitPointers(p, p + 1); } 8544 virtual void VisitPointer(Object** p) { VisitPointers(p, p + 1); }
8530 8545
8531 // Visit pointer embedded into a code object. 8546 // Visit pointer embedded into a code object.
8532 virtual void VisitEmbeddedPointer(RelocInfo* rinfo); 8547 virtual void VisitEmbeddedPointer(RelocInfo* rinfo);
8533 8548
8549 virtual void VisitSharedFunctionInfo(SharedFunctionInfo* shared) {}
8550
8534 // Visits a contiguous arrays of external references (references to the C++ 8551 // Visits a contiguous arrays of external references (references to the C++
8535 // heap) in the half-open range [start, end). Any or all of the values 8552 // heap) in the half-open range [start, end). Any or all of the values
8536 // may be modified on return. 8553 // may be modified on return.
8537 virtual void VisitExternalReferences(Address* start, Address* end) {} 8554 virtual void VisitExternalReferences(Address* start, Address* end) {}
8538 8555
8539 virtual void VisitExternalReference(RelocInfo* rinfo); 8556 virtual void VisitExternalReference(RelocInfo* rinfo);
8540 8557
8541 inline void VisitExternalReference(Address* p) { 8558 inline void VisitExternalReference(Address* p) {
8542 VisitExternalReferences(p, p + 1); 8559 VisitExternalReferences(p, p + 1);
8543 } 8560 }
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
8583 } else { 8600 } else {
8584 value &= ~(1 << bit_position); 8601 value &= ~(1 << bit_position);
8585 } 8602 }
8586 return value; 8603 return value;
8587 } 8604 }
8588 }; 8605 };
8589 8606
8590 } } // namespace v8::internal 8607 } } // namespace v8::internal
8591 8608
8592 #endif // V8_OBJECTS_H_ 8609 #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