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

Side by Side Diff: src/objects.h

Issue 1316933002: [es6] Initial steps towards a correct implementation of IsCallable. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase again. Created 5 years, 3 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/object-observe.js ('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 // 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 998 matching lines...) Expand 10 before | Expand all | Expand 10 after
1009 INLINE(bool IsFixedArrayBase() const); 1009 INLINE(bool IsFixedArrayBase() const);
1010 INLINE(bool IsExternal() const); 1010 INLINE(bool IsExternal() const);
1011 INLINE(bool IsAccessorInfo() const); 1011 INLINE(bool IsAccessorInfo() const);
1012 1012
1013 INLINE(bool IsStruct() const); 1013 INLINE(bool IsStruct() const);
1014 #define DECLARE_STRUCT_PREDICATE(NAME, Name, name) \ 1014 #define DECLARE_STRUCT_PREDICATE(NAME, Name, name) \
1015 INLINE(bool Is##Name() const); 1015 INLINE(bool Is##Name() const);
1016 STRUCT_LIST(DECLARE_STRUCT_PREDICATE) 1016 STRUCT_LIST(DECLARE_STRUCT_PREDICATE)
1017 #undef DECLARE_STRUCT_PREDICATE 1017 #undef DECLARE_STRUCT_PREDICATE
1018 1018
1019 // ES6, section 7.2.3 IsCallable.
1020 INLINE(bool IsCallable() const);
1021
1019 INLINE(bool IsSpecObject()) const; 1022 INLINE(bool IsSpecObject()) const;
1023 // TODO(rossberg): IsSpecFunction should be removed in favor of IsCallable.
1020 INLINE(bool IsSpecFunction()) const; 1024 INLINE(bool IsSpecFunction()) const;
1021 INLINE(bool IsTemplateInfo()) const; 1025 INLINE(bool IsTemplateInfo()) const;
1022 INLINE(bool IsNameDictionary() const); 1026 INLINE(bool IsNameDictionary() const);
1023 INLINE(bool IsGlobalDictionary() const); 1027 INLINE(bool IsGlobalDictionary() const);
1024 INLINE(bool IsSeededNumberDictionary() const); 1028 INLINE(bool IsSeededNumberDictionary() const);
1025 INLINE(bool IsUnseededNumberDictionary() const); 1029 INLINE(bool IsUnseededNumberDictionary() const);
1026 INLINE(bool IsOrderedHashSet() const); 1030 INLINE(bool IsOrderedHashSet() const);
1027 INLINE(bool IsOrderedHashMap() const); 1031 INLINE(bool IsOrderedHashMap() const);
1028 bool IsCallable() const;
1029 static bool IsPromise(Handle<Object> object); 1032 static bool IsPromise(Handle<Object> object);
1030 1033
1031 // Oddball testing. 1034 // Oddball testing.
1032 INLINE(bool IsUndefined() const); 1035 INLINE(bool IsUndefined() const);
1033 INLINE(bool IsNull() const); 1036 INLINE(bool IsNull() const);
1034 INLINE(bool IsTheHole() const); 1037 INLINE(bool IsTheHole() const);
1035 INLINE(bool IsException() const); 1038 INLINE(bool IsException() const);
1036 INLINE(bool IsUninitialized() const); 1039 INLINE(bool IsUninitialized() const);
1037 INLINE(bool IsTrue() const); 1040 INLINE(bool IsTrue() const);
1038 INLINE(bool IsFalse() const); 1041 INLINE(bool IsFalse() const);
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
1100 Handle<Object> input); 1103 Handle<Object> input);
1101 1104
1102 // ES6 section 7.1.12 ToString 1105 // ES6 section 7.1.12 ToString
1103 MUST_USE_RESULT static MaybeHandle<String> ToString(Isolate* isolate, 1106 MUST_USE_RESULT static MaybeHandle<String> ToString(Isolate* isolate,
1104 Handle<Object> input); 1107 Handle<Object> input);
1105 1108
1106 // ES6 section 7.3.9 GetMethod 1109 // ES6 section 7.3.9 GetMethod
1107 MUST_USE_RESULT static MaybeHandle<Object> GetMethod( 1110 MUST_USE_RESULT static MaybeHandle<Object> GetMethod(
1108 Handle<JSReceiver> receiver, Handle<Name> name); 1111 Handle<JSReceiver> receiver, Handle<Name> name);
1109 1112
1113 // ES6 section 12.5.6 The typeof Operator
1114 static Handle<String> TypeOf(Isolate* isolate, Handle<Object> object);
1115
1110 MUST_USE_RESULT static MaybeHandle<Object> GetProperty( 1116 MUST_USE_RESULT static MaybeHandle<Object> GetProperty(
1111 LookupIterator* it, LanguageMode language_mode = SLOPPY); 1117 LookupIterator* it, LanguageMode language_mode = SLOPPY);
1112 1118
1113 // Implementation of [[Put]], ECMA-262 5th edition, section 8.12.5. 1119 // Implementation of [[Put]], ECMA-262 5th edition, section 8.12.5.
1114 MUST_USE_RESULT static MaybeHandle<Object> SetProperty( 1120 MUST_USE_RESULT static MaybeHandle<Object> SetProperty(
1115 Handle<Object> object, Handle<Name> name, Handle<Object> value, 1121 Handle<Object> object, Handle<Name> name, Handle<Object> value,
1116 LanguageMode language_mode, 1122 LanguageMode language_mode,
1117 StoreFromKeyed store_mode = MAY_BE_STORE_FROM_KEYED); 1123 StoreFromKeyed store_mode = MAY_BE_STORE_FROM_KEYED);
1118 1124
1119 MUST_USE_RESULT static MaybeHandle<Object> SetProperty( 1125 MUST_USE_RESULT static MaybeHandle<Object> SetProperty(
(...skipping 4106 matching lines...) Expand 10 before | Expand all | Expand 10 after
5226 inline uint32_t bit_field3() const; 5232 inline uint32_t bit_field3() const;
5227 inline void set_bit_field3(uint32_t bits); 5233 inline void set_bit_field3(uint32_t bits);
5228 5234
5229 class EnumLengthBits: public BitField<int, 5235 class EnumLengthBits: public BitField<int,
5230 0, kDescriptorIndexBitCount> {}; // NOLINT 5236 0, kDescriptorIndexBitCount> {}; // NOLINT
5231 class NumberOfOwnDescriptorsBits: public BitField<int, 5237 class NumberOfOwnDescriptorsBits: public BitField<int,
5232 kDescriptorIndexBitCount, kDescriptorIndexBitCount> {}; // NOLINT 5238 kDescriptorIndexBitCount, kDescriptorIndexBitCount> {}; // NOLINT
5233 STATIC_ASSERT(kDescriptorIndexBitCount + kDescriptorIndexBitCount == 20); 5239 STATIC_ASSERT(kDescriptorIndexBitCount + kDescriptorIndexBitCount == 20);
5234 class DictionaryMap : public BitField<bool, 20, 1> {}; 5240 class DictionaryMap : public BitField<bool, 20, 1> {};
5235 class OwnsDescriptors : public BitField<bool, 21, 1> {}; 5241 class OwnsDescriptors : public BitField<bool, 21, 1> {};
5236 class HasInstanceCallHandler : public BitField<bool, 22, 1> {}; 5242 class IsHiddenPrototype : public BitField<bool, 22, 1> {};
5237 class Deprecated : public BitField<bool, 23, 1> {}; 5243 class Deprecated : public BitField<bool, 23, 1> {};
5238 class IsUnstable : public BitField<bool, 24, 1> {}; 5244 class IsUnstable : public BitField<bool, 24, 1> {};
5239 class IsMigrationTarget : public BitField<bool, 25, 1> {}; 5245 class IsMigrationTarget : public BitField<bool, 25, 1> {};
5240 class IsStrong : public BitField<bool, 26, 1> {}; 5246 class IsStrong : public BitField<bool, 26, 1> {};
5241 // Bit 27 is free. 5247 // Bit 27 is free.
5242 5248
5243 // Keep this bit field at the very end for better code in 5249 // Keep this bit field at the very end for better code in
5244 // Builtins::kJSConstructStubGeneric stub. 5250 // Builtins::kJSConstructStubGeneric stub.
5245 // This counter is used for in-object slack tracking and for map aging. 5251 // This counter is used for in-object slack tracking and for map aging.
5246 // The in-object slack tracking is considered enabled when the counter is 5252 // The in-object slack tracking is considered enabled when the counter is
(...skipping 14 matching lines...) Expand all
5261 5267
5262 // Tells whether function has special prototype property. If not, prototype 5268 // Tells whether function has special prototype property. If not, prototype
5263 // property will not be created when accessed (will return undefined), 5269 // property will not be created when accessed (will return undefined),
5264 // and construction from this function will not be allowed. 5270 // and construction from this function will not be allowed.
5265 inline void set_function_with_prototype(bool value); 5271 inline void set_function_with_prototype(bool value);
5266 inline bool function_with_prototype(); 5272 inline bool function_with_prototype();
5267 5273
5268 // Tells whether the instance with this map should be ignored by the 5274 // Tells whether the instance with this map should be ignored by the
5269 // Object.getPrototypeOf() function and the __proto__ accessor. 5275 // Object.getPrototypeOf() function and the __proto__ accessor.
5270 inline void set_is_hidden_prototype(); 5276 inline void set_is_hidden_prototype();
5271 inline bool is_hidden_prototype(); 5277 inline bool is_hidden_prototype() const;
5272 5278
5273 // Records and queries whether the instance has a named interceptor. 5279 // Records and queries whether the instance has a named interceptor.
5274 inline void set_has_named_interceptor(); 5280 inline void set_has_named_interceptor();
5275 inline bool has_named_interceptor(); 5281 inline bool has_named_interceptor();
5276 5282
5277 // Records and queries whether the instance has an indexed interceptor. 5283 // Records and queries whether the instance has an indexed interceptor.
5278 inline void set_has_indexed_interceptor(); 5284 inline void set_has_indexed_interceptor();
5279 inline bool has_indexed_interceptor(); 5285 inline bool has_indexed_interceptor();
5280 5286
5281 // Tells whether the instance is undetectable. 5287 // Tells whether the instance is undetectable.
5282 // An undetectable object is a special class of JSObject: 'typeof' operator 5288 // An undetectable object is a special class of JSObject: 'typeof' operator
5283 // returns undefined, ToBoolean returns false. Otherwise it behaves like 5289 // returns undefined, ToBoolean returns false. Otherwise it behaves like
5284 // a normal JS object. It is useful for implementing undetectable 5290 // a normal JS object. It is useful for implementing undetectable
5285 // document.all in Firefox & Safari. 5291 // document.all in Firefox & Safari.
5286 // See https://bugzilla.mozilla.org/show_bug.cgi?id=248549. 5292 // See https://bugzilla.mozilla.org/show_bug.cgi?id=248549.
5287 inline void set_is_undetectable(); 5293 inline void set_is_undetectable();
5288 inline bool is_undetectable(); 5294 inline bool is_undetectable();
5289 5295
5290 // Tells whether the instance has a call-as-function handler. 5296 // Tells whether the instance has a call-as-function handler.
5291 inline void set_is_observed(); 5297 inline void set_is_observed();
5292 inline bool is_observed(); 5298 inline bool is_observed();
5293 5299
5300 // Tells whether the instance has a [[Call]] internal field.
5301 // This property is implemented according to ES6, section 7.2.3.
5302 inline void set_is_callable();
5303 inline bool is_callable() const;
5304
5294 inline void set_is_strong(); 5305 inline void set_is_strong();
5295 inline bool is_strong(); 5306 inline bool is_strong();
5296 inline void set_is_extensible(bool value); 5307 inline void set_is_extensible(bool value);
5297 inline bool is_extensible(); 5308 inline bool is_extensible();
5298 inline void set_is_prototype_map(bool value); 5309 inline void set_is_prototype_map(bool value);
5299 inline bool is_prototype_map() const; 5310 inline bool is_prototype_map() const;
5300 5311
5301 inline void set_elements_kind(ElementsKind elements_kind); 5312 inline void set_elements_kind(ElementsKind elements_kind);
5302 inline ElementsKind elements_kind(); 5313 inline ElementsKind elements_kind();
5303 5314
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
5459 inline int NumberOfOwnDescriptors(); 5470 inline int NumberOfOwnDescriptors();
5460 inline void SetNumberOfOwnDescriptors(int number); 5471 inline void SetNumberOfOwnDescriptors(int number);
5461 5472
5462 inline Cell* RetrieveDescriptorsPointer(); 5473 inline Cell* RetrieveDescriptorsPointer();
5463 5474
5464 inline int EnumLength(); 5475 inline int EnumLength();
5465 inline void SetEnumLength(int length); 5476 inline void SetEnumLength(int length);
5466 5477
5467 inline bool owns_descriptors(); 5478 inline bool owns_descriptors();
5468 inline void set_owns_descriptors(bool owns_descriptors); 5479 inline void set_owns_descriptors(bool owns_descriptors);
5469 inline bool has_instance_call_handler();
5470 inline void set_has_instance_call_handler();
5471 inline void mark_unstable(); 5480 inline void mark_unstable();
5472 inline bool is_stable(); 5481 inline bool is_stable();
5473 inline void set_migration_target(bool value); 5482 inline void set_migration_target(bool value);
5474 inline bool is_migration_target(); 5483 inline bool is_migration_target();
5475 inline void set_counter(int value); 5484 inline void set_counter(int value);
5476 inline int counter(); 5485 inline int counter();
5477 inline void deprecate(); 5486 inline void deprecate();
5478 inline bool is_deprecated(); 5487 inline bool is_deprecated();
5479 inline bool CanBeDeprecated(); 5488 inline bool CanBeDeprecated();
5480 // Returns a non-deprecated version of the input. If the input was not 5489 // Returns a non-deprecated version of the input. If the input was not
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
5709 kInstanceAttributesOffset + 0; 5718 kInstanceAttributesOffset + 0;
5710 static const int kBitField2Offset = kInstanceAttributesOffset + 2; 5719 static const int kBitField2Offset = kInstanceAttributesOffset + 2;
5711 static const int kUnusedPropertyFieldsByte = 3; 5720 static const int kUnusedPropertyFieldsByte = 3;
5712 static const int kUnusedPropertyFieldsOffset = kInstanceAttributesOffset + 3; 5721 static const int kUnusedPropertyFieldsOffset = kInstanceAttributesOffset + 3;
5713 5722
5714 STATIC_ASSERT(kInstanceTypeAndBitFieldOffset == 5723 STATIC_ASSERT(kInstanceTypeAndBitFieldOffset ==
5715 Internals::kMapInstanceTypeAndBitFieldOffset); 5724 Internals::kMapInstanceTypeAndBitFieldOffset);
5716 5725
5717 // Bit positions for bit field. 5726 // Bit positions for bit field.
5718 static const int kHasNonInstancePrototype = 0; 5727 static const int kHasNonInstancePrototype = 0;
5719 static const int kIsHiddenPrototype = 1; 5728 static const int kIsCallable = 1;
5720 static const int kHasNamedInterceptor = 2; 5729 static const int kHasNamedInterceptor = 2;
5721 static const int kHasIndexedInterceptor = 3; 5730 static const int kHasIndexedInterceptor = 3;
5722 static const int kIsUndetectable = 4; 5731 static const int kIsUndetectable = 4;
5723 static const int kIsObserved = 5; 5732 static const int kIsObserved = 5;
5724 static const int kIsAccessCheckNeeded = 6; 5733 static const int kIsAccessCheckNeeded = 6;
5725 class FunctionWithPrototype: public BitField<bool, 7, 1> {}; 5734 class FunctionWithPrototype: public BitField<bool, 7, 1> {};
5726 5735
5727 // Bit positions for bit field 2 5736 // Bit positions for bit field 2
5728 static const int kIsExtensible = 0; 5737 static const int kIsExtensible = 0;
5729 static const int kStringWrapperSafeForDefaultValueOf = 1; 5738 static const int kStringWrapperSafeForDefaultValueOf = 1;
(...skipping 3561 matching lines...) Expand 10 before | Expand all | Expand 10 after
9291 9300
9292 static Handle<Smi> GetOrCreateIdentityHash(Handle<JSProxy> proxy); 9301 static Handle<Smi> GetOrCreateIdentityHash(Handle<JSProxy> proxy);
9293 9302
9294 DISALLOW_IMPLICIT_CONSTRUCTORS(JSProxy); 9303 DISALLOW_IMPLICIT_CONSTRUCTORS(JSProxy);
9295 }; 9304 };
9296 9305
9297 9306
9298 class JSFunctionProxy: public JSProxy { 9307 class JSFunctionProxy: public JSProxy {
9299 public: 9308 public:
9300 // [call_trap]: The call trap. 9309 // [call_trap]: The call trap.
9301 DECL_ACCESSORS(call_trap, Object) 9310 DECL_ACCESSORS(call_trap, JSReceiver)
9302 9311
9303 // [construct_trap]: The construct trap. 9312 // [construct_trap]: The construct trap.
9304 DECL_ACCESSORS(construct_trap, Object) 9313 DECL_ACCESSORS(construct_trap, Object)
9305 9314
9306 DECLARE_CAST(JSFunctionProxy) 9315 DECLARE_CAST(JSFunctionProxy)
9307 9316
9308 // Dispatched behavior. 9317 // Dispatched behavior.
9309 DECLARE_PRINTER(JSFunctionProxy) 9318 DECLARE_PRINTER(JSFunctionProxy)
9310 DECLARE_VERIFIER(JSFunctionProxy) 9319 DECLARE_VERIFIER(JSFunctionProxy)
9311 9320
(...skipping 1067 matching lines...) Expand 10 before | Expand all | Expand 10 after
10379 } else { 10388 } else {
10380 value &= ~(1 << bit_position); 10389 value &= ~(1 << bit_position);
10381 } 10390 }
10382 return value; 10391 return value;
10383 } 10392 }
10384 }; 10393 };
10385 10394
10386 } } // namespace v8::internal 10395 } } // namespace v8::internal
10387 10396
10388 #endif // V8_OBJECTS_H_ 10397 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/object-observe.js ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698