OLD | NEW |
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 6180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6191 // Common super class for JavaScript global objects and the special | 6191 // Common super class for JavaScript global objects and the special |
6192 // builtins global objects. | 6192 // builtins global objects. |
6193 class GlobalObject: public JSObject { | 6193 class GlobalObject: public JSObject { |
6194 public: | 6194 public: |
6195 // [builtins]: the object holding the runtime routines written in JS. | 6195 // [builtins]: the object holding the runtime routines written in JS. |
6196 DECL_ACCESSORS(builtins, JSBuiltinsObject) | 6196 DECL_ACCESSORS(builtins, JSBuiltinsObject) |
6197 | 6197 |
6198 // [native context]: the natives corresponding to this global object. | 6198 // [native context]: the natives corresponding to this global object. |
6199 DECL_ACCESSORS(native_context, Context) | 6199 DECL_ACCESSORS(native_context, Context) |
6200 | 6200 |
| 6201 // [global context]: the most recent (i.e. innermost) global context. |
| 6202 DECL_ACCESSORS(global_context, Context) |
| 6203 |
6201 // [global receiver]: the global receiver object of the context | 6204 // [global receiver]: the global receiver object of the context |
6202 DECL_ACCESSORS(global_receiver, JSObject) | 6205 DECL_ACCESSORS(global_receiver, JSObject) |
6203 | 6206 |
6204 // Retrieve the property cell used to store a property. | 6207 // Retrieve the property cell used to store a property. |
6205 JSGlobalPropertyCell* GetPropertyCell(LookupResult* result); | 6208 JSGlobalPropertyCell* GetPropertyCell(LookupResult* result); |
6206 | 6209 |
6207 // This is like GetProperty, but is used when you know the lookup won't fail | 6210 // This is like GetProperty, but is used when you know the lookup won't fail |
6208 // by throwing an exception. This is for the debug and builtins global | 6211 // by throwing an exception. This is for the debug and builtins global |
6209 // objects, where it is known which properties can be expected to be present | 6212 // objects, where it is known which properties can be expected to be present |
6210 // on the object. | 6213 // on the object. |
6211 Object* GetPropertyNoExceptionThrown(String* key) { | 6214 Object* GetPropertyNoExceptionThrown(String* key) { |
6212 Object* answer = GetProperty(key)->ToObjectUnchecked(); | 6215 Object* answer = GetProperty(key)->ToObjectUnchecked(); |
6213 return answer; | 6216 return answer; |
6214 } | 6217 } |
6215 | 6218 |
6216 // Ensure that the global object has a cell for the given property name. | 6219 // Ensure that the global object has a cell for the given property name. |
6217 static Handle<JSGlobalPropertyCell> EnsurePropertyCell( | 6220 static Handle<JSGlobalPropertyCell> EnsurePropertyCell( |
6218 Handle<GlobalObject> global, | 6221 Handle<GlobalObject> global, |
6219 Handle<String> name); | 6222 Handle<String> name); |
6220 // TODO(kmillikin): This function can be eliminated once the stub cache is | 6223 // TODO(kmillikin): This function can be eliminated once the stub cache is |
6221 // full handlified (and the static helper can be written directly). | 6224 // full handlified (and the static helper can be written directly). |
6222 MUST_USE_RESULT MaybeObject* EnsurePropertyCell(String* name); | 6225 MUST_USE_RESULT MaybeObject* EnsurePropertyCell(String* name); |
6223 | 6226 |
6224 // Casting. | 6227 // Casting. |
6225 static inline GlobalObject* cast(Object* obj); | 6228 static inline GlobalObject* cast(Object* obj); |
6226 | 6229 |
6227 // Layout description. | 6230 // Layout description. |
6228 static const int kBuiltinsOffset = JSObject::kHeaderSize; | 6231 static const int kBuiltinsOffset = JSObject::kHeaderSize; |
6229 static const int kNativeContextOffset = kBuiltinsOffset + kPointerSize; | 6232 static const int kNativeContextOffset = kBuiltinsOffset + kPointerSize; |
6230 static const int kGlobalReceiverOffset = kNativeContextOffset + kPointerSize; | 6233 static const int kGlobalContextOffset = kNativeContextOffset + kPointerSize; |
| 6234 static const int kGlobalReceiverOffset = kGlobalContextOffset + kPointerSize; |
6231 static const int kHeaderSize = kGlobalReceiverOffset + kPointerSize; | 6235 static const int kHeaderSize = kGlobalReceiverOffset + kPointerSize; |
6232 | 6236 |
6233 private: | 6237 private: |
6234 DISALLOW_IMPLICIT_CONSTRUCTORS(GlobalObject); | 6238 DISALLOW_IMPLICIT_CONSTRUCTORS(GlobalObject); |
6235 }; | 6239 }; |
6236 | 6240 |
6237 | 6241 |
6238 // JavaScript global object. | 6242 // JavaScript global object. |
6239 class JSGlobalObject: public GlobalObject { | 6243 class JSGlobalObject: public GlobalObject { |
6240 public: | 6244 public: |
(...skipping 2691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8932 } else { | 8936 } else { |
8933 value &= ~(1 << bit_position); | 8937 value &= ~(1 << bit_position); |
8934 } | 8938 } |
8935 return value; | 8939 return value; |
8936 } | 8940 } |
8937 }; | 8941 }; |
8938 | 8942 |
8939 } } // namespace v8::internal | 8943 } } // namespace v8::internal |
8940 | 8944 |
8941 #endif // V8_OBJECTS_H_ | 8945 #endif // V8_OBJECTS_H_ |
OLD | NEW |