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

Side by Side Diff: src/top.cc

Issue 113622: Expose the calling context through the API. ... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 7 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/top.h ('k') | test/cctest/test-api.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 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 863 matching lines...) Expand 10 before | Expand all | Expand 10 after
874 return false; 874 return false;
875 } 875 }
876 876
877 877
878 Handle<Context> Top::global_context() { 878 Handle<Context> Top::global_context() {
879 GlobalObject* global = thread_local_.context_->global(); 879 GlobalObject* global = thread_local_.context_->global();
880 return Handle<Context>(global->global_context()); 880 return Handle<Context>(global->global_context());
881 } 881 }
882 882
883 883
884 Handle<Context> Top::GetCallingGlobalContext() {
885 JavaScriptFrameIterator it;
886 if (it.done()) return Handle<Context>::null();
887 JavaScriptFrame* frame = it.frame();
888 Context* context = Context::cast(frame->context());
889 return Handle<Context>(context->global_context());
890 }
891
892
884 Object* Top::LookupSpecialFunction(JSObject* receiver, 893 Object* Top::LookupSpecialFunction(JSObject* receiver,
885 JSObject* prototype, 894 JSObject* prototype,
886 JSFunction* function) { 895 JSFunction* function) {
887 if (receiver->IsJSArray()) { 896 if (receiver->IsJSArray()) {
888 FixedArray* table = context()->global_context()->special_function_table(); 897 FixedArray* table = context()->global_context()->special_function_table();
889 for (int index = 0; index < table->length(); index +=3) { 898 for (int index = 0; index < table->length(); index +=3) {
890 if ((prototype == table->get(index)) && 899 if ((prototype == table->get(index)) &&
891 (function == table->get(index+1))) { 900 (function == table->get(index+1))) {
892 return table->get(index+2); 901 return table->get(index+2);
893 } 902 }
(...skipping 20 matching lines...) Expand all
914 Top::break_access_->Lock(); 923 Top::break_access_->Lock();
915 } 924 }
916 925
917 926
918 ExecutionAccess::~ExecutionAccess() { 927 ExecutionAccess::~ExecutionAccess() {
919 Top::break_access_->Unlock(); 928 Top::break_access_->Unlock();
920 } 929 }
921 930
922 931
923 } } // namespace v8::internal 932 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/top.h ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698