OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 friend class HandleScopeImplementer; | 280 friend class HandleScopeImplementer; |
281 }; | 281 }; |
282 | 282 |
283 | 283 |
284 // ---------------------------------------------------------------------------- | 284 // ---------------------------------------------------------------------------- |
285 // Handle operations. | 285 // Handle operations. |
286 // They might invoke garbage collection. The result is an handle to | 286 // They might invoke garbage collection. The result is an handle to |
287 // an object of expected type, or the handle is an error if running out | 287 // an object of expected type, or the handle is an error if running out |
288 // of space or encountering an internal error. | 288 // of space or encountering an internal error. |
289 | 289 |
290 Handle<Object> GetProperty(Handle<JSReceiver> obj, const char* name); | 290 MUST_USE_RESULT MaybeHandle<Object> GetProperty(Handle<JSReceiver> obj, |
| 291 const char* name); |
291 | 292 |
292 // Get the JS object corresponding to the given script; create it | 293 // Get the JS object corresponding to the given script; create it |
293 // if none exists. | 294 // if none exists. |
294 Handle<JSValue> GetScriptWrapper(Handle<Script> script); | 295 Handle<JSValue> GetScriptWrapper(Handle<Script> script); |
295 | 296 |
296 // Script line number computations. Note that the line number is zero-based. | 297 // Script line number computations. Note that the line number is zero-based. |
297 void InitScriptLineEnds(Handle<Script> script); | 298 void InitScriptLineEnds(Handle<Script> script); |
298 // For string calculates an array of line end positions. If the string | 299 // For string calculates an array of line end positions. If the string |
299 // does not end with a new line character, this character may optionally be | 300 // does not end with a new line character, this character may optionally be |
300 // imagined. | 301 // imagined. |
301 Handle<FixedArray> CalculateLineEnds(Handle<String> string, | 302 Handle<FixedArray> CalculateLineEnds(Handle<String> string, |
302 bool with_imaginary_last_new_line); | 303 bool with_imaginary_last_new_line); |
303 int GetScriptLineNumber(Handle<Script> script, int code_position); | 304 int GetScriptLineNumber(Handle<Script> script, int code_position); |
304 // The safe version does not make heap allocations but may work much slower. | 305 // The safe version does not make heap allocations but may work much slower. |
305 int GetScriptLineNumberSafe(Handle<Script> script, int code_position); | 306 int GetScriptLineNumberSafe(Handle<Script> script, int code_position); |
306 int GetScriptColumnNumber(Handle<Script> script, int code_position); | 307 int GetScriptColumnNumber(Handle<Script> script, int code_position); |
307 Handle<Object> GetScriptNameOrSourceURL(Handle<Script> script); | 308 Handle<Object> GetScriptNameOrSourceURL(Handle<Script> script); |
308 | 309 |
309 // Computes the enumerable keys from interceptors. Used for debug mirrors and | 310 // Computes the enumerable keys from interceptors. Used for debug mirrors and |
310 // by GetKeysInFixedArrayFor below. | 311 // by GetKeysInFixedArrayFor below. |
311 v8::Handle<v8::Array> GetKeysForNamedInterceptor(Handle<JSReceiver> receiver, | 312 v8::Handle<v8::Array> GetKeysForNamedInterceptor(Handle<JSReceiver> receiver, |
312 Handle<JSObject> object); | 313 Handle<JSObject> object); |
313 v8::Handle<v8::Array> GetKeysForIndexedInterceptor(Handle<JSReceiver> receiver, | 314 v8::Handle<v8::Array> GetKeysForIndexedInterceptor(Handle<JSReceiver> receiver, |
314 Handle<JSObject> object); | 315 Handle<JSObject> object); |
315 | 316 |
316 enum KeyCollectionType { LOCAL_ONLY, INCLUDE_PROTOS }; | 317 enum KeyCollectionType { LOCAL_ONLY, INCLUDE_PROTOS }; |
317 | 318 |
318 // Computes the enumerable keys for a JSObject. Used for implementing | 319 // Computes the enumerable keys for a JSObject. Used for implementing |
319 // "for (n in object) { }". | 320 // "for (n in object) { }". |
320 Handle<FixedArray> GetKeysInFixedArrayFor(Handle<JSReceiver> object, | 321 MUST_USE_RESULT MaybeHandle<FixedArray> GetKeysInFixedArrayFor( |
321 KeyCollectionType type, | 322 Handle<JSReceiver> object, |
322 bool* threw); | 323 KeyCollectionType type); |
323 Handle<JSArray> GetKeysFor(Handle<JSReceiver> object, bool* threw); | 324 MUST_USE_RESULT MaybeHandle<JSArray> GetKeysFor(Handle<JSReceiver> object); |
324 Handle<FixedArray> ReduceFixedArrayTo(Handle<FixedArray> array, int length); | 325 Handle<FixedArray> ReduceFixedArrayTo(Handle<FixedArray> array, int length); |
325 Handle<FixedArray> GetEnumPropertyKeys(Handle<JSObject> object, | 326 Handle<FixedArray> GetEnumPropertyKeys(Handle<JSObject> object, |
326 bool cache_result); | 327 bool cache_result); |
327 | 328 |
328 Handle<JSGlobalProxy> ReinitializeJSGlobalProxy( | 329 Handle<JSGlobalProxy> ReinitializeJSGlobalProxy( |
329 Handle<JSFunction> constructor, | 330 Handle<JSFunction> constructor, |
330 Handle<JSGlobalProxy> global); | 331 Handle<JSGlobalProxy> global); |
331 | 332 |
332 void AddWeakObjectToCodeDependency(Heap* heap, | 333 void AddWeakObjectToCodeDependency(Heap* heap, |
333 Handle<Object> object, | 334 Handle<Object> object, |
(...skipping 23 matching lines...) Expand all Loading... |
357 | 358 |
358 void Initialize() { | 359 void Initialize() { |
359 next = limit = NULL; | 360 next = limit = NULL; |
360 level = 0; | 361 level = 0; |
361 } | 362 } |
362 }; | 363 }; |
363 | 364 |
364 } } // namespace v8::internal | 365 } } // namespace v8::internal |
365 | 366 |
366 #endif // V8_HANDLES_H_ | 367 #endif // V8_HANDLES_H_ |
OLD | NEW |