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

Side by Side Diff: src/objects.h

Issue 1183733006: Keep a canonical list of shared function infos. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: serializer tweak Created 5 years, 6 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
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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/allocation.h" 10 #include "src/allocation.h"
(...skipping 6388 matching lines...) Expand 10 before | Expand all | Expand 10 after
6399 static const int kPrototypeUsersOffset = HeapObject::kHeaderSize; 6399 static const int kPrototypeUsersOffset = HeapObject::kHeaderSize;
6400 static const int kValidityCellOffset = kPrototypeUsersOffset + kPointerSize; 6400 static const int kValidityCellOffset = kPrototypeUsersOffset + kPointerSize;
6401 static const int kConstructorNameOffset = kValidityCellOffset + kPointerSize; 6401 static const int kConstructorNameOffset = kValidityCellOffset + kPointerSize;
6402 static const int kSize = kConstructorNameOffset + kPointerSize; 6402 static const int kSize = kConstructorNameOffset + kPointerSize;
6403 6403
6404 private: 6404 private:
6405 DISALLOW_IMPLICIT_CONSTRUCTORS(PrototypeInfo); 6405 DISALLOW_IMPLICIT_CONSTRUCTORS(PrototypeInfo);
6406 }; 6406 };
6407 6407
6408 6408
6409 // Forward declaration.
6410 class SharedFunctionInfo;
Michael Starzinger 2015/06/19 11:17:08 nit: Can we just move this up to the forward decla
6411
6409 // Script describes a script which has been added to the VM. 6412 // Script describes a script which has been added to the VM.
6410 class Script: public Struct { 6413 class Script: public Struct {
6411 public: 6414 public:
6412 // Script types. 6415 // Script types.
6413 enum Type { 6416 enum Type {
6414 TYPE_NATIVE = 0, 6417 TYPE_NATIVE = 0,
6415 TYPE_EXTENSION = 1, 6418 TYPE_EXTENSION = 1,
6416 TYPE_NORMAL = 2 6419 TYPE_NORMAL = 2
6417 }; 6420 };
6418 6421
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
6457 DECL_ACCESSORS(line_ends, Object) 6460 DECL_ACCESSORS(line_ends, Object)
6458 6461
6459 // [eval_from_shared]: for eval scripts the shared funcion info for the 6462 // [eval_from_shared]: for eval scripts the shared funcion info for the
6460 // function from which eval was called. 6463 // function from which eval was called.
6461 DECL_ACCESSORS(eval_from_shared, Object) 6464 DECL_ACCESSORS(eval_from_shared, Object)
6462 6465
6463 // [eval_from_instructions_offset]: the instruction offset in the code for the 6466 // [eval_from_instructions_offset]: the instruction offset in the code for the
6464 // function from which eval was called where eval was called. 6467 // function from which eval was called where eval was called.
6465 DECL_ACCESSORS(eval_from_instructions_offset, Smi) 6468 DECL_ACCESSORS(eval_from_instructions_offset, Smi)
6466 6469
6470 // [shared_function_infos]: weak fixed array containing all shared
6471 // function infos created from this script.
6472 DECL_ACCESSORS(shared_function_infos, Object)
6473
6467 // [flags]: Holds an exciting bitfield. 6474 // [flags]: Holds an exciting bitfield.
6468 DECL_ACCESSORS(flags, Smi) 6475 DECL_ACCESSORS(flags, Smi)
6469 6476
6470 // [source_url]: sourceURL from magic comment 6477 // [source_url]: sourceURL from magic comment
6471 DECL_ACCESSORS(source_url, Object) 6478 DECL_ACCESSORS(source_url, Object)
6472 6479
6473 // [source_url]: sourceMappingURL magic comment 6480 // [source_url]: sourceMappingURL magic comment
6474 DECL_ACCESSORS(source_mapping_url, Object) 6481 DECL_ACCESSORS(source_mapping_url, Object)
6475 6482
6476 // [compilation_type]: how the the script was compiled. Encoded in the 6483 // [compilation_type]: how the the script was compiled. Encoded in the
(...skipping 27 matching lines...) Expand all
6504 int GetLineNumber(int code_pos); 6511 int GetLineNumber(int code_pos);
6505 6512
6506 static Handle<Object> GetNameOrSourceURL(Handle<Script> script); 6513 static Handle<Object> GetNameOrSourceURL(Handle<Script> script);
6507 6514
6508 // Init line_ends array with code positions of line ends inside script source. 6515 // Init line_ends array with code positions of line ends inside script source.
6509 static void InitLineEnds(Handle<Script> script); 6516 static void InitLineEnds(Handle<Script> script);
6510 6517
6511 // Get the JS object wrapping the given script; create it if none exists. 6518 // Get the JS object wrapping the given script; create it if none exists.
6512 static Handle<JSObject> GetWrapper(Handle<Script> script); 6519 static Handle<JSObject> GetWrapper(Handle<Script> script);
6513 6520
6521 MaybeHandle<SharedFunctionInfo> FindSharedFunctionInfo(FunctionLiteral* fun);
Michael Starzinger 2015/06/19 11:17:08 nit: IMHO this function needs short explaining com
6522
6523 static void AddSharedFunctionInfo(Handle<Script> script,
Michael Starzinger 2015/06/19 11:17:08 nit: This shouldn't be needed anymore, correct?
6524 Handle<SharedFunctionInfo> shared);
6525
6514 // Dispatched behavior. 6526 // Dispatched behavior.
6515 DECLARE_PRINTER(Script) 6527 DECLARE_PRINTER(Script)
6516 DECLARE_VERIFIER(Script) 6528 DECLARE_VERIFIER(Script)
6517 6529
6518 static const int kSourceOffset = HeapObject::kHeaderSize; 6530 static const int kSourceOffset = HeapObject::kHeaderSize;
6519 static const int kNameOffset = kSourceOffset + kPointerSize; 6531 static const int kNameOffset = kSourceOffset + kPointerSize;
6520 static const int kLineOffsetOffset = kNameOffset + kPointerSize; 6532 static const int kLineOffsetOffset = kNameOffset + kPointerSize;
6521 static const int kColumnOffsetOffset = kLineOffsetOffset + kPointerSize; 6533 static const int kColumnOffsetOffset = kLineOffsetOffset + kPointerSize;
6522 static const int kContextOffset = kColumnOffsetOffset + kPointerSize; 6534 static const int kContextOffset = kColumnOffsetOffset + kPointerSize;
6523 static const int kWrapperOffset = kContextOffset + kPointerSize; 6535 static const int kWrapperOffset = kContextOffset + kPointerSize;
6524 static const int kTypeOffset = kWrapperOffset + kPointerSize; 6536 static const int kTypeOffset = kWrapperOffset + kPointerSize;
6525 static const int kLineEndsOffset = kTypeOffset + kPointerSize; 6537 static const int kLineEndsOffset = kTypeOffset + kPointerSize;
6526 static const int kIdOffset = kLineEndsOffset + kPointerSize; 6538 static const int kIdOffset = kLineEndsOffset + kPointerSize;
6527 static const int kEvalFromSharedOffset = kIdOffset + kPointerSize; 6539 static const int kEvalFromSharedOffset = kIdOffset + kPointerSize;
6528 static const int kEvalFrominstructionsOffsetOffset = 6540 static const int kEvalFrominstructionsOffsetOffset =
6529 kEvalFromSharedOffset + kPointerSize; 6541 kEvalFromSharedOffset + kPointerSize;
6530 static const int kFlagsOffset = 6542 static const int kSharedFunctionInfosOffset =
6531 kEvalFrominstructionsOffsetOffset + kPointerSize; 6543 kEvalFrominstructionsOffsetOffset + kPointerSize;
6544 static const int kFlagsOffset = kSharedFunctionInfosOffset + kPointerSize;
6532 static const int kSourceUrlOffset = kFlagsOffset + kPointerSize; 6545 static const int kSourceUrlOffset = kFlagsOffset + kPointerSize;
6533 static const int kSourceMappingUrlOffset = kSourceUrlOffset + kPointerSize; 6546 static const int kSourceMappingUrlOffset = kSourceUrlOffset + kPointerSize;
6534 static const int kSize = kSourceMappingUrlOffset + kPointerSize; 6547 static const int kSize = kSourceMappingUrlOffset + kPointerSize;
6535 6548
6536 private: 6549 private:
6537 int GetLineNumberWithArray(int code_pos); 6550 int GetLineNumberWithArray(int code_pos);
6538 6551
6539 // Bit positions in the flags field. 6552 // Bit positions in the flags field.
6540 static const int kCompilationTypeBit = 0; 6553 static const int kCompilationTypeBit = 0;
6541 static const int kCompilationStateBit = 1; 6554 static const int kCompilationStateBit = 1;
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
6652 static void InitFromFunctionLiteral(Handle<SharedFunctionInfo> shared_info, 6665 static void InitFromFunctionLiteral(Handle<SharedFunctionInfo> shared_info,
6653 FunctionLiteral* lit); 6666 FunctionLiteral* lit);
6654 6667
6655 // Add a new entry to the optimized code map. 6668 // Add a new entry to the optimized code map.
6656 static void AddToOptimizedCodeMap(Handle<SharedFunctionInfo> shared, 6669 static void AddToOptimizedCodeMap(Handle<SharedFunctionInfo> shared,
6657 Handle<Context> native_context, 6670 Handle<Context> native_context,
6658 Handle<Code> code, 6671 Handle<Code> code,
6659 Handle<FixedArray> literals, 6672 Handle<FixedArray> literals,
6660 BailoutId osr_ast_id); 6673 BailoutId osr_ast_id);
6661 6674
6675 static void SetScript(Handle<SharedFunctionInfo> shared,
Michael Starzinger 2015/06/19 11:17:08 nit: Likewise, can we get a comment?
6676 Handle<Object> script_object);
6677
6662 // Layout description of the optimized code map. 6678 // Layout description of the optimized code map.
6663 static const int kNextMapIndex = 0; 6679 static const int kNextMapIndex = 0;
6664 static const int kEntriesStart = 1; 6680 static const int kEntriesStart = 1;
6665 static const int kContextOffset = 0; 6681 static const int kContextOffset = 0;
6666 static const int kCachedCodeOffset = 1; 6682 static const int kCachedCodeOffset = 1;
6667 static const int kLiteralsOffset = 2; 6683 static const int kLiteralsOffset = 2;
6668 static const int kOsrAstIdOffset = 3; 6684 static const int kOsrAstIdOffset = 3;
6669 static const int kEntryLength = 4; 6685 static const int kEntryLength = 4;
6670 static const int kInitialLength = kEntriesStart + kEntryLength; 6686 static const int kInitialLength = kEntriesStart + kEntryLength;
6671 6687
(...skipping 23 matching lines...) Expand all
6695 6711
6696 // [expected_nof_properties]: Expected number of properties for the function. 6712 // [expected_nof_properties]: Expected number of properties for the function.
6697 inline int expected_nof_properties() const; 6713 inline int expected_nof_properties() const;
6698 inline void set_expected_nof_properties(int value); 6714 inline void set_expected_nof_properties(int value);
6699 6715
6700 // [feedback_vector] - accumulates ast node feedback from full-codegen and 6716 // [feedback_vector] - accumulates ast node feedback from full-codegen and
6701 // (increasingly) from crankshafted code where sufficient feedback isn't 6717 // (increasingly) from crankshafted code where sufficient feedback isn't
6702 // available. 6718 // available.
6703 DECL_ACCESSORS(feedback_vector, TypeFeedbackVector) 6719 DECL_ACCESSORS(feedback_vector, TypeFeedbackVector)
6704 6720
6721 // A WeakFixedArray of inner shared function infos.
6722 DECL_ACCESSORS(inner_functions, Object)
Michael Starzinger 2015/06/19 11:17:08 nit: This shouldn't be needed anymore, correct?
6723
6705 #if TRACE_MAPS 6724 #if TRACE_MAPS
6706 // [unique_id] - For --trace-maps purposes, an identifier that's persistent 6725 // [unique_id] - For --trace-maps purposes, an identifier that's persistent
6707 // even if the GC moves this SharedFunctionInfo. 6726 // even if the GC moves this SharedFunctionInfo.
6708 inline int unique_id() const; 6727 inline int unique_id() const;
6709 inline void set_unique_id(int value); 6728 inline void set_unique_id(int value);
6710 #endif 6729 #endif
6711 6730
6712 // [instance class name]: class name for instances. 6731 // [instance class name]: class name for instances.
6713 DECL_ACCESSORS(instance_class_name, Object) 6732 DECL_ACCESSORS(instance_class_name, Object)
6714 6733
(...skipping 4149 matching lines...) Expand 10 before | Expand all | Expand 10 after
10864 } else { 10883 } else {
10865 value &= ~(1 << bit_position); 10884 value &= ~(1 << bit_position);
10866 } 10885 }
10867 return value; 10886 return value;
10868 } 10887 }
10869 }; 10888 };
10870 10889
10871 } } // namespace v8::internal 10890 } } // namespace v8::internal
10872 10891
10873 #endif // V8_OBJECTS_H_ 10892 #endif // V8_OBJECTS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698