| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 22 matching lines...) Expand all Loading... |
| 33 namespace v8 { | 33 namespace v8 { |
| 34 namespace internal { | 34 namespace internal { |
| 35 | 35 |
| 36 | 36 |
| 37 #define RETURN_IF_SCHEDULED_EXCEPTION() \ | 37 #define RETURN_IF_SCHEDULED_EXCEPTION() \ |
| 38 if (Top::has_scheduled_exception()) return Top::PromoteScheduledException() | 38 if (Top::has_scheduled_exception()) return Top::PromoteScheduledException() |
| 39 | 39 |
| 40 // Top has static variables used for JavaScript execution. | 40 // Top has static variables used for JavaScript execution. |
| 41 | 41 |
| 42 class SaveContext; // Forward declaration. | 42 class SaveContext; // Forward declaration. |
| 43 class ThreadVisitor; // Defined in v8threads.h |
| 43 | 44 |
| 44 class ThreadLocalTop BASE_EMBEDDED { | 45 class ThreadLocalTop BASE_EMBEDDED { |
| 45 public: | 46 public: |
| 46 // Initialize the thread data. | 47 // Initialize the thread data. |
| 47 void Initialize(); | 48 void Initialize(); |
| 48 | 49 |
| 49 // Get the top C++ try catch handler or NULL if none are registered. | 50 // Get the top C++ try catch handler or NULL if none are registered. |
| 50 // | 51 // |
| 51 // This method is not guarenteed to return an address that can be | 52 // This method is not guarenteed to return an address that can be |
| 52 // used for comparison with addresses into the JS stack. If such an | 53 // used for comparison with addresses into the JS stack. If such an |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 // Out of resource exception helpers. | 313 // Out of resource exception helpers. |
| 313 static Failure* StackOverflow(); | 314 static Failure* StackOverflow(); |
| 314 static Failure* TerminateExecution(); | 315 static Failure* TerminateExecution(); |
| 315 | 316 |
| 316 // Administration | 317 // Administration |
| 317 static void Initialize(); | 318 static void Initialize(); |
| 318 static void TearDown(); | 319 static void TearDown(); |
| 319 static void Iterate(ObjectVisitor* v); | 320 static void Iterate(ObjectVisitor* v); |
| 320 static void Iterate(ObjectVisitor* v, ThreadLocalTop* t); | 321 static void Iterate(ObjectVisitor* v, ThreadLocalTop* t); |
| 321 static char* Iterate(ObjectVisitor* v, char* t); | 322 static char* Iterate(ObjectVisitor* v, char* t); |
| 323 static void IterateThread(ThreadVisitor* v); |
| 324 static void IterateThread(ThreadVisitor* v, char* t); |
| 322 | 325 |
| 323 // Returns the global object of the current context. It could be | 326 // Returns the global object of the current context. It could be |
| 324 // a builtin object, or a js global object. | 327 // a builtin object, or a js global object. |
| 325 static Handle<GlobalObject> global() { | 328 static Handle<GlobalObject> global() { |
| 326 return Handle<GlobalObject>(context()->global()); | 329 return Handle<GlobalObject>(context()->global()); |
| 327 } | 330 } |
| 328 | 331 |
| 329 // Returns the global proxy object of the current context. | 332 // Returns the global proxy object of the current context. |
| 330 static Object* global_proxy() { | 333 static Object* global_proxy() { |
| 331 return context()->global_proxy(); | 334 return context()->global_proxy(); |
| 332 } | 335 } |
| 333 | 336 |
| 334 // Returns the current global context. | 337 // Returns the current global context. |
| 335 static Handle<Context> global_context(); | 338 static Handle<Context> global_context(); |
| 336 | 339 |
| 337 // Returns the global context of the calling JavaScript code. That | 340 // Returns the global context of the calling JavaScript code. That |
| 338 // is, the global context of the top-most JavaScript frame. | 341 // is, the global context of the top-most JavaScript frame. |
| 339 static Handle<Context> GetCallingGlobalContext(); | 342 static Handle<Context> GetCallingGlobalContext(); |
| 340 | 343 |
| 341 static Handle<JSBuiltinsObject> builtins() { | 344 static Handle<JSBuiltinsObject> builtins() { |
| 342 return Handle<JSBuiltinsObject>(thread_local_.context_->builtins()); | 345 return Handle<JSBuiltinsObject>(thread_local_.context_->builtins()); |
| 343 } | 346 } |
| 344 | 347 |
| 345 static bool CanHaveSpecialFunctions(JSObject* object); | |
| 346 static Object* LookupSpecialFunction(JSObject* receiver, | |
| 347 JSObject* prototype, | |
| 348 JSFunction* value); | |
| 349 | |
| 350 static void RegisterTryCatchHandler(v8::TryCatch* that); | 348 static void RegisterTryCatchHandler(v8::TryCatch* that); |
| 351 static void UnregisterTryCatchHandler(v8::TryCatch* that); | 349 static void UnregisterTryCatchHandler(v8::TryCatch* that); |
| 352 | 350 |
| 353 #define TOP_GLOBAL_CONTEXT_FIELD_ACCESSOR(index, type, name) \ | 351 #define TOP_GLOBAL_CONTEXT_FIELD_ACCESSOR(index, type, name) \ |
| 354 static Handle<type> name() { \ | 352 static Handle<type> name() { \ |
| 355 return Handle<type>(context()->global_context()->name()); \ | 353 return Handle<type>(context()->global_context()->name()); \ |
| 356 } | 354 } |
| 357 GLOBAL_CONTEXT_FIELDS(TOP_GLOBAL_CONTEXT_FIELD_ACCESSOR) | 355 GLOBAL_CONTEXT_FIELDS(TOP_GLOBAL_CONTEXT_FIELD_ACCESSOR) |
| 358 #undef TOP_GLOBAL_CONTEXT_FIELD_ACCESSOR | 356 #undef TOP_GLOBAL_CONTEXT_FIELD_ACCESSOR |
| 359 | 357 |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 451 | 449 |
| 452 class ExecutionAccess BASE_EMBEDDED { | 450 class ExecutionAccess BASE_EMBEDDED { |
| 453 public: | 451 public: |
| 454 ExecutionAccess(); | 452 ExecutionAccess(); |
| 455 ~ExecutionAccess(); | 453 ~ExecutionAccess(); |
| 456 }; | 454 }; |
| 457 | 455 |
| 458 } } // namespace v8::internal | 456 } } // namespace v8::internal |
| 459 | 457 |
| 460 #endif // V8_TOP_H_ | 458 #endif // V8_TOP_H_ |
| OLD | NEW |