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

Side by Side Diff: src/objects.h

Issue 237673014: Move functions from handles.cc to where they belong. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: rebox Created 6 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/messages.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 1517 matching lines...) Expand 10 before | Expand all | Expand 10 after
1528 void Lookup(Name* name, LookupResult* result); 1528 void Lookup(Name* name, LookupResult* result);
1529 1529
1530 MUST_USE_RESULT static MaybeHandle<Object> GetPropertyWithReceiver( 1530 MUST_USE_RESULT static MaybeHandle<Object> GetPropertyWithReceiver(
1531 Handle<Object> object, 1531 Handle<Object> object,
1532 Handle<Object> receiver, 1532 Handle<Object> receiver,
1533 Handle<Name> name, 1533 Handle<Name> name,
1534 PropertyAttributes* attributes); 1534 PropertyAttributes* attributes);
1535 MUST_USE_RESULT static inline MaybeHandle<Object> GetPropertyOrElement( 1535 MUST_USE_RESULT static inline MaybeHandle<Object> GetPropertyOrElement(
1536 Handle<Object> object, 1536 Handle<Object> object,
1537 Handle<Name> key); 1537 Handle<Name> key);
1538 1538 MUST_USE_RESULT static inline MaybeHandle<Object> GetProperty(
1539 Isolate* isolate,
1540 Handle<Object> object,
1541 const char* key);
1539 MUST_USE_RESULT static inline MaybeHandle<Object> GetProperty( 1542 MUST_USE_RESULT static inline MaybeHandle<Object> GetProperty(
1540 Handle<Object> object, 1543 Handle<Object> object,
1541 Handle<Name> key); 1544 Handle<Name> key);
1542 MUST_USE_RESULT static MaybeHandle<Object> GetProperty( 1545 MUST_USE_RESULT static MaybeHandle<Object> GetProperty(
1543 Handle<Object> object, 1546 Handle<Object> object,
1544 Handle<Object> receiver, 1547 Handle<Object> receiver,
1545 LookupResult* result, 1548 LookupResult* result,
1546 Handle<Name> key, 1549 Handle<Name> key,
1547 PropertyAttributes* attributes); 1550 PropertyAttributes* attributes);
1548 1551
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after
2101 // hash code if needed and none exists. 2104 // hash code if needed and none exists.
2102 inline static Handle<Object> GetOrCreateIdentityHash( 2105 inline static Handle<Object> GetOrCreateIdentityHash(
2103 Handle<JSReceiver> object); 2106 Handle<JSReceiver> object);
2104 2107
2105 // Lookup a property. If found, the result is valid and has 2108 // Lookup a property. If found, the result is valid and has
2106 // detailed information. 2109 // detailed information.
2107 void LocalLookup(Name* name, LookupResult* result, 2110 void LocalLookup(Name* name, LookupResult* result,
2108 bool search_hidden_prototypes = false); 2111 bool search_hidden_prototypes = false);
2109 void Lookup(Name* name, LookupResult* result); 2112 void Lookup(Name* name, LookupResult* result);
2110 2113
2114 enum KeyCollectionType { LOCAL_ONLY, INCLUDE_PROTOS };
2115
2116 // Computes the enumerable keys for a JSObject. Used for implementing
2117 // "for (n in object) { }".
2118 MUST_USE_RESULT static MaybeHandle<FixedArray> GetKeys(
2119 Handle<JSReceiver> object,
2120 KeyCollectionType type);
2121
2111 protected: 2122 protected:
2112 Smi* GenerateIdentityHash(); 2123 Smi* GenerateIdentityHash();
2113 2124
2114 MUST_USE_RESULT static MaybeHandle<Object> SetPropertyWithDefinedSetter( 2125 MUST_USE_RESULT static MaybeHandle<Object> SetPropertyWithDefinedSetter(
2115 Handle<JSReceiver> object, 2126 Handle<JSReceiver> object,
2116 Handle<JSReceiver> setter, 2127 Handle<JSReceiver> setter,
2117 Handle<Object> value); 2128 Handle<Object> value);
2118 2129
2119 private: 2130 private:
2120 static PropertyAttributes GetPropertyAttributeForResult( 2131 static PropertyAttributes GetPropertyAttributeForResult(
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after
2516 int length); 2527 int length);
2517 MUST_USE_RESULT MaybeObject* SetFastDoubleElementsCapacityAndLength( 2528 MUST_USE_RESULT MaybeObject* SetFastDoubleElementsCapacityAndLength(
2518 int capacity, 2529 int capacity,
2519 int length); 2530 int length);
2520 2531
2521 // Lookup interceptors are used for handling properties controlled by host 2532 // Lookup interceptors are used for handling properties controlled by host
2522 // objects. 2533 // objects.
2523 inline bool HasNamedInterceptor(); 2534 inline bool HasNamedInterceptor();
2524 inline bool HasIndexedInterceptor(); 2535 inline bool HasIndexedInterceptor();
2525 2536
2537 // Computes the enumerable keys from interceptors. Used for debug mirrors and
2538 // by JSReceiver::GetKeys.
2539 MUST_USE_RESULT static MaybeHandle<JSArray> GetKeysForNamedInterceptor(
2540 Handle<JSObject> object,
2541 Handle<JSReceiver> receiver);
2542 MUST_USE_RESULT static MaybeHandle<JSArray> GetKeysForIndexedInterceptor(
2543 Handle<JSObject> object,
2544 Handle<JSReceiver> receiver);
2545
2526 // Support functions for v8 api (needed for correct interceptor behavior). 2546 // Support functions for v8 api (needed for correct interceptor behavior).
2527 static bool HasRealNamedProperty(Handle<JSObject> object, 2547 static bool HasRealNamedProperty(Handle<JSObject> object,
2528 Handle<Name> key); 2548 Handle<Name> key);
2529 static bool HasRealElementProperty(Handle<JSObject> object, uint32_t index); 2549 static bool HasRealElementProperty(Handle<JSObject> object, uint32_t index);
2530 static bool HasRealNamedCallbackProperty(Handle<JSObject> object, 2550 static bool HasRealNamedCallbackProperty(Handle<JSObject> object,
2531 Handle<Name> key); 2551 Handle<Name> key);
2532 2552
2533 // Get the header size for a JSObject. Used to compute the index of 2553 // Get the header size for a JSObject. Used to compute the index of
2534 // internal fields as well as the number of internal fields. 2554 // internal fields as well as the number of internal fields.
2535 inline int GetHeaderSize(); 2555 inline int GetHeaderSize();
(...skipping 4296 matching lines...) Expand 10 before | Expand all | Expand 10 after
6832 // script's level of privilege. V8 just passes this through. Encoded in 6852 // script's level of privilege. V8 just passes this through. Encoded in
6833 // the 'flags' field. 6853 // the 'flags' field.
6834 DECL_BOOLEAN_ACCESSORS(is_shared_cross_origin) 6854 DECL_BOOLEAN_ACCESSORS(is_shared_cross_origin)
6835 6855
6836 static inline Script* cast(Object* obj); 6856 static inline Script* cast(Object* obj);
6837 6857
6838 // If script source is an external string, check that the underlying 6858 // If script source is an external string, check that the underlying
6839 // resource is accessible. Otherwise, always return true. 6859 // resource is accessible. Otherwise, always return true.
6840 inline bool HasValidSource(); 6860 inline bool HasValidSource();
6841 6861
6862 // Convert code position into column number.
6863 static int GetColumnNumber(Handle<Script> script, int code_pos);
6864
6865 // Convert code position into (zero-based) line number.
6866 // The non-handlified version does not allocate, but may be much slower.
6867 static int GetLineNumber(Handle<Script> script, int code_pos);
6868 int GetLineNumber(int code_pos);
6869
6870 static Handle<Object> GetNameOrSourceURL(Handle<Script> script);
6871
6872 // Init line_ends array with code positions of line ends inside script source.
6873 static void InitLineEnds(Handle<Script> script);
6874
6875 // Get the JS object wrapping the given script; create it if none exists.
6876 static Handle<JSObject> GetWrapper(Handle<Script> script);
6877
6842 // Dispatched behavior. 6878 // Dispatched behavior.
6843 DECLARE_PRINTER(Script) 6879 DECLARE_PRINTER(Script)
6844 DECLARE_VERIFIER(Script) 6880 DECLARE_VERIFIER(Script)
6845 6881
6846 static const int kSourceOffset = HeapObject::kHeaderSize; 6882 static const int kSourceOffset = HeapObject::kHeaderSize;
6847 static const int kNameOffset = kSourceOffset + kPointerSize; 6883 static const int kNameOffset = kSourceOffset + kPointerSize;
6848 static const int kLineOffsetOffset = kNameOffset + kPointerSize; 6884 static const int kLineOffsetOffset = kNameOffset + kPointerSize;
6849 static const int kColumnOffsetOffset = kLineOffsetOffset + kPointerSize; 6885 static const int kColumnOffsetOffset = kLineOffsetOffset + kPointerSize;
6850 static const int kContextOffset = kColumnOffsetOffset + kPointerSize; 6886 static const int kContextOffset = kColumnOffsetOffset + kPointerSize;
6851 static const int kWrapperOffset = kContextOffset + kPointerSize; 6887 static const int kWrapperOffset = kContextOffset + kPointerSize;
6852 static const int kTypeOffset = kWrapperOffset + kPointerSize; 6888 static const int kTypeOffset = kWrapperOffset + kPointerSize;
6853 static const int kLineEndsOffset = kTypeOffset + kPointerSize; 6889 static const int kLineEndsOffset = kTypeOffset + kPointerSize;
6854 static const int kIdOffset = kLineEndsOffset + kPointerSize; 6890 static const int kIdOffset = kLineEndsOffset + kPointerSize;
6855 static const int kEvalFromSharedOffset = kIdOffset + kPointerSize; 6891 static const int kEvalFromSharedOffset = kIdOffset + kPointerSize;
6856 static const int kEvalFrominstructionsOffsetOffset = 6892 static const int kEvalFrominstructionsOffsetOffset =
6857 kEvalFromSharedOffset + kPointerSize; 6893 kEvalFromSharedOffset + kPointerSize;
6858 static const int kFlagsOffset = 6894 static const int kFlagsOffset =
6859 kEvalFrominstructionsOffsetOffset + kPointerSize; 6895 kEvalFrominstructionsOffsetOffset + kPointerSize;
6860 static const int kSize = kFlagsOffset + kPointerSize; 6896 static const int kSize = kFlagsOffset + kPointerSize;
6861 6897
6862 private: 6898 private:
6899 int GetLineNumberWithArray(int code_pos);
6900
6863 // Bit positions in the flags field. 6901 // Bit positions in the flags field.
6864 static const int kCompilationTypeBit = 0; 6902 static const int kCompilationTypeBit = 0;
6865 static const int kCompilationStateBit = 1; 6903 static const int kCompilationStateBit = 1;
6866 static const int kIsSharedCrossOriginBit = 2; 6904 static const int kIsSharedCrossOriginBit = 2;
6867 6905
6868 DISALLOW_IMPLICIT_CONSTRUCTORS(Script); 6906 DISALLOW_IMPLICIT_CONSTRUCTORS(Script);
6869 }; 6907 };
6870 6908
6871 6909
6872 // List of builtin functions we want to identify to improve code 6910 // List of builtin functions we want to identify to improve code
(...skipping 2349 matching lines...) Expand 10 before | Expand all | Expand 10 after
9222 int32_t type); 9260 int32_t type);
9223 9261
9224 template<class Visitor> 9262 template<class Visitor>
9225 static inline ConsString* VisitFlat(Visitor* visitor, 9263 static inline ConsString* VisitFlat(Visitor* visitor,
9226 String* string, 9264 String* string,
9227 int offset = 0) { 9265 int offset = 0) {
9228 int32_t type = string->map()->instance_type(); 9266 int32_t type = string->map()->instance_type();
9229 return VisitFlat(visitor, string, offset, string->length(), type); 9267 return VisitFlat(visitor, string, offset, string->length(), type);
9230 } 9268 }
9231 9269
9270 static Handle<FixedArray> CalculateLineEnds(Handle<String> string,
9271 bool include_ending_line);
9272
9232 private: 9273 private:
9233 friend class Name; 9274 friend class Name;
9234 9275
9235 static Handle<String> SlowFlatten(Handle<ConsString> cons, 9276 static Handle<String> SlowFlatten(Handle<ConsString> cons,
9236 PretenureFlag tenure); 9277 PretenureFlag tenure);
9237 9278
9238 // Slow case of String::Equals. This implementation works on any strings 9279 // Slow case of String::Equals. This implementation works on any strings
9239 // but it is most efficient on strings that are almost flat. 9280 // but it is most efficient on strings that are almost flat.
9240 bool SlowEquals(String* other); 9281 bool SlowEquals(String* other);
9241 9282
(...skipping 1802 matching lines...) Expand 10 before | Expand all | Expand 10 after
11044 } else { 11085 } else {
11045 value &= ~(1 << bit_position); 11086 value &= ~(1 << bit_position);
11046 } 11087 }
11047 return value; 11088 return value;
11048 } 11089 }
11049 }; 11090 };
11050 11091
11051 } } // namespace v8::internal 11092 } } // namespace v8::internal
11052 11093
11053 #endif // V8_OBJECTS_H_ 11094 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/messages.cc ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698