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

Side by Side Diff: src/objects.h

Issue 1140673002: [V8] Added Script::is_opaque flag for embedders (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: incorporated Yang's comment Created 5 years, 7 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/debug.cc ('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 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 6720 matching lines...) Expand 10 before | Expand all | Expand 10 after
6731 // [compilation_type]: how the the script was compiled. Encoded in the 6731 // [compilation_type]: how the the script was compiled. Encoded in the
6732 // 'flags' field. 6732 // 'flags' field.
6733 inline CompilationType compilation_type(); 6733 inline CompilationType compilation_type();
6734 inline void set_compilation_type(CompilationType type); 6734 inline void set_compilation_type(CompilationType type);
6735 6735
6736 // [compilation_state]: determines whether the script has already been 6736 // [compilation_state]: determines whether the script has already been
6737 // compiled. Encoded in the 'flags' field. 6737 // compiled. Encoded in the 'flags' field.
6738 inline CompilationState compilation_state(); 6738 inline CompilationState compilation_state();
6739 inline void set_compilation_state(CompilationState state); 6739 inline void set_compilation_state(CompilationState state);
6740 6740
6741 // [is_embedder_debug_script]: An opaque boolean set by the embedder via 6741 // [origin_options]: optional attributes set by the embedder via ScriptOrigin,
6742 // ScriptOrigin, and used by the embedder to make decisions about the 6742 // and used by the embedder to make decisions about the script. V8 just passes
6743 // script's origin. V8 just passes this through. Encoded in 6743 // this through. Encoded in the 'flags' field.
6744 // the 'flags' field. 6744 inline ScriptOriginOptions origin_options();
Yang 2015/05/18 11:21:25 Please change this to v8::ScriptOriginOptions to b
horo 2015/05/18 13:19:53 Done.
6745 DECL_BOOLEAN_ACCESSORS(is_embedder_debug_script) 6745 inline void set_origin_options(ScriptOriginOptions origin_options);
6746
6747 // [is_shared_cross_origin]: An opaque boolean set by the embedder via
6748 // ScriptOrigin, and used by the embedder to make decisions about the
6749 // script's level of privilege. V8 just passes this through. Encoded in
6750 // the 'flags' field.
6751 DECL_BOOLEAN_ACCESSORS(is_shared_cross_origin)
6752 6746
6753 DECLARE_CAST(Script) 6747 DECLARE_CAST(Script)
6754 6748
6755 // If script source is an external string, check that the underlying 6749 // If script source is an external string, check that the underlying
6756 // resource is accessible. Otherwise, always return true. 6750 // resource is accessible. Otherwise, always return true.
6757 inline bool HasValidSource(); 6751 inline bool HasValidSource();
6758 6752
6759 // Convert code position into column number. 6753 // Convert code position into column number.
6760 static int GetColumnNumber(Handle<Script> script, int code_pos); 6754 static int GetColumnNumber(Handle<Script> script, int code_pos);
6761 6755
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
6793 static const int kSourceUrlOffset = kFlagsOffset + kPointerSize; 6787 static const int kSourceUrlOffset = kFlagsOffset + kPointerSize;
6794 static const int kSourceMappingUrlOffset = kSourceUrlOffset + kPointerSize; 6788 static const int kSourceMappingUrlOffset = kSourceUrlOffset + kPointerSize;
6795 static const int kSize = kSourceMappingUrlOffset + kPointerSize; 6789 static const int kSize = kSourceMappingUrlOffset + kPointerSize;
6796 6790
6797 private: 6791 private:
6798 int GetLineNumberWithArray(int code_pos); 6792 int GetLineNumberWithArray(int code_pos);
6799 6793
6800 // Bit positions in the flags field. 6794 // Bit positions in the flags field.
6801 static const int kCompilationTypeBit = 0; 6795 static const int kCompilationTypeBit = 0;
6802 static const int kCompilationStateBit = 1; 6796 static const int kCompilationStateBit = 1;
6803 static const int kIsEmbedderDebugScriptBit = 2; 6797 static const int kOriginOptionsShift = 2;
6804 static const int kIsSharedCrossOriginBit = 3; 6798 static const int kOriginOptionsSize = 3;
6799 static const int kOriginOptionsMask = ((1 << kOriginOptionsSize) - 1)
6800 << kOriginOptionsShift;
6805 6801
6806 DISALLOW_IMPLICIT_CONSTRUCTORS(Script); 6802 DISALLOW_IMPLICIT_CONSTRUCTORS(Script);
6807 }; 6803 };
6808 6804
6809 6805
6810 // List of builtin functions we want to identify to improve code 6806 // List of builtin functions we want to identify to improve code
6811 // generation. 6807 // generation.
6812 // 6808 //
6813 // Each entry has a name of a global object property holding an object 6809 // Each entry has a name of a global object property holding an object
6814 // optionally followed by ".prototype", a name of a builtin function 6810 // optionally followed by ".prototype", a name of a builtin function
(...skipping 3726 matching lines...) Expand 10 before | Expand all | Expand 10 after
10541 static const int kExpectedReceiverTypeOffset = kFlagOffset + kPointerSize; 10537 static const int kExpectedReceiverTypeOffset = kFlagOffset + kPointerSize;
10542 static const int kSize = kExpectedReceiverTypeOffset + kPointerSize; 10538 static const int kSize = kExpectedReceiverTypeOffset + kPointerSize;
10543 10539
10544 private: 10540 private:
10545 inline bool HasExpectedReceiverType() { 10541 inline bool HasExpectedReceiverType() {
10546 return expected_receiver_type()->IsFunctionTemplateInfo(); 10542 return expected_receiver_type()->IsFunctionTemplateInfo();
10547 } 10543 }
10548 // Bit positions in flag. 10544 // Bit positions in flag.
10549 static const int kAllCanReadBit = 0; 10545 static const int kAllCanReadBit = 0;
10550 static const int kAllCanWriteBit = 1; 10546 static const int kAllCanWriteBit = 1;
10551 class AttributesField: public BitField<PropertyAttributes, 2, 3> {}; 10547 class AttributesField : public BitField<PropertyAttributes, 2, 3> {};
10552 10548
10553 DISALLOW_IMPLICIT_CONSTRUCTORS(AccessorInfo); 10549 DISALLOW_IMPLICIT_CONSTRUCTORS(AccessorInfo);
10554 }; 10550 };
10555 10551
10556 10552
10557 // An accessor must have a getter, but can have no setter. 10553 // An accessor must have a getter, but can have no setter.
10558 // 10554 //
10559 // When setting a property, V8 searches accessors in prototypes. 10555 // When setting a property, V8 searches accessors in prototypes.
10560 // If an accessor was found and it does not have a setter, 10556 // If an accessor was found and it does not have a setter,
10561 // the request is ignored. 10557 // the request is ignored.
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after
11111 } else { 11107 } else {
11112 value &= ~(1 << bit_position); 11108 value &= ~(1 << bit_position);
11113 } 11109 }
11114 return value; 11110 return value;
11115 } 11111 }
11116 }; 11112 };
11117 11113
11118 } } // namespace v8::internal 11114 } } // namespace v8::internal
11119 11115
11120 #endif // V8_OBJECTS_H_ 11116 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/debug.cc ('k') | src/objects-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698