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 8226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8237 Handle<Object> name = isolate->factory()->eval_symbol(); | 8237 Handle<Object> name = isolate->factory()->eval_symbol(); |
8238 Handle<Object> reference_error = | 8238 Handle<Object> reference_error = |
8239 isolate->factory()->NewReferenceError("not_defined", | 8239 isolate->factory()->NewReferenceError("not_defined", |
8240 HandleVector(&name, 1)); | 8240 HandleVector(&name, 1)); |
8241 return MakePair(isolate->Throw(*reference_error), NULL); | 8241 return MakePair(isolate->Throw(*reference_error), NULL); |
8242 } | 8242 } |
8243 | 8243 |
8244 if (!context->IsGlobalContext()) { | 8244 if (!context->IsGlobalContext()) { |
8245 // 'eval' is not bound in the global context. Just call the function | 8245 // 'eval' is not bound in the global context. Just call the function |
8246 // with the given arguments. This is not necessarily the global eval. | 8246 // with the given arguments. This is not necessarily the global eval. |
8247 if (receiver->IsContext()) { | 8247 if (receiver->IsContext() || receiver->IsJSContextExtensionObject()) { |
8248 context = Handle<Context>::cast(receiver); | |
8249 receiver = Handle<Object>(context->get(index), isolate); | |
8250 } else if (receiver->IsJSContextExtensionObject()) { | |
8251 receiver = Handle<JSObject>( | 8248 receiver = Handle<JSObject>( |
8252 isolate->context()->global()->global_receiver(), isolate); | 8249 isolate->context()->global()->global_receiver(), isolate); |
8253 } | 8250 } |
8254 return MakePair(*callee, *receiver); | 8251 return MakePair(*callee, *receiver); |
8255 } | 8252 } |
8256 | 8253 |
8257 // 'eval' is bound in the global context, but it may have been overwritten. | 8254 // 'eval' is bound in the global context, but it may have been overwritten. |
8258 // Compare it to the builtin 'GlobalEval' function to make sure. | 8255 // Compare it to the builtin 'GlobalEval' function to make sure. |
8259 if (*callee != isolate->global_context()->global_eval_fun() || | 8256 if (*callee != isolate->global_context()->global_eval_fun() || |
8260 !args[1]->IsString()) { | 8257 !args[1]->IsString()) { |
(...skipping 3724 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11985 } else { | 11982 } else { |
11986 // Handle last resort GC and make sure to allow future allocations | 11983 // Handle last resort GC and make sure to allow future allocations |
11987 // to grow the heap without causing GCs (if possible). | 11984 // to grow the heap without causing GCs (if possible). |
11988 isolate->counters()->gc_last_resort_from_js()->Increment(); | 11985 isolate->counters()->gc_last_resort_from_js()->Increment(); |
11989 isolate->heap()->CollectAllGarbage(false); | 11986 isolate->heap()->CollectAllGarbage(false); |
11990 } | 11987 } |
11991 } | 11988 } |
11992 | 11989 |
11993 | 11990 |
11994 } } // namespace v8::internal | 11991 } } // namespace v8::internal |
OLD | NEW |