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

Side by Side Diff: src/runtime.cc

Issue 7366: Split window support from V8. ... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 12 years, 2 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/runtime.h ('k') | src/serialize.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 3805 matching lines...) Expand 10 before | Expand all | Expand 10 after
3816 return *adaptor; 3816 return *adaptor;
3817 } 3817 }
3818 3818
3819 3819
3820 static Object* Runtime_EvalReceiver(Arguments args) { 3820 static Object* Runtime_EvalReceiver(Arguments args) {
3821 StackFrameLocator locator; 3821 StackFrameLocator locator;
3822 return locator.FindJavaScriptFrame(1)->receiver(); 3822 return locator.FindJavaScriptFrame(1)->receiver();
3823 } 3823 }
3824 3824
3825 3825
3826 static Object* Runtime_GlobalReceiver(Arguments args) {
3827 ASSERT(args.length() == 1);
3828 Object* global = args[0];
3829 if (!global->IsJSGlobalObject()) return Heap::null_value();
3830 return JSGlobalObject::cast(global)->global_receiver();
3831 }
3832
3833
3826 static Object* Runtime_CompileString(Arguments args) { 3834 static Object* Runtime_CompileString(Arguments args) {
3827 HandleScope scope; 3835 HandleScope scope;
3828 ASSERT(args.length() == 3); 3836 ASSERT(args.length() == 3);
3829 CONVERT_ARG_CHECKED(String, source, 0); 3837 CONVERT_ARG_CHECKED(String, source, 0);
3830 CONVERT_ARG_CHECKED(Smi, line_offset, 1); 3838 CONVERT_ARG_CHECKED(Smi, line_offset, 1);
3831 bool contextual = args[2]->IsTrue(); 3839 bool contextual = args[2]->IsTrue();
3832 RUNTIME_ASSERT(contextual || args[2]->IsFalse()); 3840 RUNTIME_ASSERT(contextual || args[2]->IsFalse());
3833 3841
3834 // Compute the eval context. 3842 // Compute the eval context.
3835 Handle<Context> context; 3843 Handle<Context> context;
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
4109 case NULL_DESCRIPTOR: 4117 case NULL_DESCRIPTOR:
4110 return Heap::undefined_value(); 4118 return Heap::undefined_value();
4111 default: 4119 default:
4112 UNREACHABLE(); 4120 UNREACHABLE();
4113 } 4121 }
4114 UNREACHABLE(); 4122 UNREACHABLE();
4115 return Heap::undefined_value(); 4123 return Heap::undefined_value();
4116 } 4124 }
4117 4125
4118 4126
4119 static Object* Runtime_DebugGetLocalPropertyDetails(Arguments args) { 4127 static Object* Runtime_DebugGetPropertyDetails(Arguments args) {
4120 HandleScope scope; 4128 HandleScope scope;
4121 4129
4122 ASSERT(args.length() == 2); 4130 ASSERT(args.length() == 2);
4123 4131
4124 CONVERT_ARG_CHECKED(JSObject, obj, 0); 4132 CONVERT_ARG_CHECKED(JSObject, obj, 0);
4125 CONVERT_ARG_CHECKED(String, name, 1); 4133 CONVERT_ARG_CHECKED(String, name, 1);
4126 4134
4127 // Check if the name is trivially convertible to an index and get the element 4135 // Check if the name is trivially convertible to an index and get the element
4128 // if so. 4136 // if so.
4129 uint32_t index; 4137 uint32_t index;
4130 if (name->AsArrayIndex(&index)) { 4138 if (name->AsArrayIndex(&index)) {
4131 Handle<FixedArray> details = Factory::NewFixedArray(2); 4139 Handle<FixedArray> details = Factory::NewFixedArray(2);
4132 details->set(0, Runtime::GetElementOrCharAt(obj, index)); 4140 details->set(0, Runtime::GetElementOrCharAt(obj, index));
4133 details->set(1, PropertyDetails(NONE, NORMAL).AsSmi()); 4141 details->set(1, PropertyDetails(NONE, NORMAL).AsSmi());
4134 return *Factory::NewJSArrayWithElements(details); 4142 return *Factory::NewJSArrayWithElements(details);
4135 } 4143 }
4136 4144
4137 // Perform standard local lookup on the object. 4145 // Perform standard local lookup on the object.
4138 LookupResult result; 4146 LookupResult result;
4139 obj->LocalLookup(*name, &result); 4147 obj->Lookup(*name, &result);
4140 if (result.IsProperty()) { 4148 if (result.IsProperty()) {
4141 Handle<Object> value(DebugLookupResultValue(&result)); 4149 Handle<Object> value(DebugLookupResultValue(&result));
4142 Handle<FixedArray> details = Factory::NewFixedArray(2); 4150 Handle<FixedArray> details = Factory::NewFixedArray(2);
4143 details->set(0, *value); 4151 details->set(0, *value);
4144 details->set(1, result.GetPropertyDetails().AsSmi()); 4152 details->set(1, result.GetPropertyDetails().AsSmi());
4145 return *Factory::NewJSArrayWithElements(details); 4153 return *Factory::NewJSArrayWithElements(details);
4146 } 4154 }
4147 return Heap::undefined_value(); 4155 return Heap::undefined_value();
4148 } 4156 }
4149 4157
(...skipping 731 matching lines...) Expand 10 before | Expand all | Expand 10 after
4881 4889
4882 // Traverse the saved contexts chain to find the active context for the 4890 // Traverse the saved contexts chain to find the active context for the
4883 // selected frame. 4891 // selected frame.
4884 SaveContext* save = Top::save_context(); 4892 SaveContext* save = Top::save_context();
4885 while (save != NULL && reinterpret_cast<Address>(save) < frame->sp()) { 4893 while (save != NULL && reinterpret_cast<Address>(save) < frame->sp()) {
4886 save = save->prev(); 4894 save = save->prev();
4887 } 4895 }
4888 ASSERT(save != NULL); 4896 ASSERT(save != NULL);
4889 SaveContext savex; 4897 SaveContext savex;
4890 Top::set_context(*(save->context())); 4898 Top::set_context(*(save->context()));
4891 Top::set_security_context(*(save->security_context()));
4892 4899
4893 // Create the (empty) function replacing the function on the stack frame for 4900 // Create the (empty) function replacing the function on the stack frame for
4894 // the purpose of evaluating in the context created below. It is important 4901 // the purpose of evaluating in the context created below. It is important
4895 // that this function does not describe any parameters and local variables 4902 // that this function does not describe any parameters and local variables
4896 // in the context. If it does then this will cause problems with the lookup 4903 // in the context. If it does then this will cause problems with the lookup
4897 // in Context::Lookup, where context slots for parameters and local variables 4904 // in Context::Lookup, where context slots for parameters and local variables
4898 // are looked at before the extension object. 4905 // are looked at before the extension object.
4899 Handle<JSFunction> go_between = 4906 Handle<JSFunction> go_between =
4900 Factory::NewFunction(Factory::empty_string(), Factory::undefined_value()); 4907 Factory::NewFunction(Factory::empty_string(), Factory::undefined_value());
4901 go_between->set_context(function->context()); 4908 go_between->set_context(function->context());
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
5008 DisableBreak disable_break_save(disable_break); 5015 DisableBreak disable_break_save(disable_break);
5009 5016
5010 // Enter the top context from before the debugger was invoked. 5017 // Enter the top context from before the debugger was invoked.
5011 SaveContext save; 5018 SaveContext save;
5012 SaveContext* top = &save; 5019 SaveContext* top = &save;
5013 while (top != NULL && *top->context() == *Debug::debug_context()) { 5020 while (top != NULL && *top->context() == *Debug::debug_context()) {
5014 top = top->prev(); 5021 top = top->prev();
5015 } 5022 }
5016 if (top != NULL) { 5023 if (top != NULL) {
5017 Top::set_context(*top->context()); 5024 Top::set_context(*top->context());
5018 Top::set_security_context(*top->security_context());
5019 } 5025 }
5020 5026
5021 // Get the global context now set to the top context from before the 5027 // Get the global context now set to the top context from before the
5022 // debugger was invoked. 5028 // debugger was invoked.
5023 Handle<Context> context = Top::global_context(); 5029 Handle<Context> context = Top::global_context();
5024 5030
5025 // Compile the source to be evaluated. 5031 // Compile the source to be evaluated.
5026 Handle<JSFunction> boilerplate(Compiler::CompileEval(source, 0, true)); 5032 Handle<JSFunction> boilerplate(Compiler::CompileEval(source, 0, true));
5027 if (boilerplate.is_null()) return Failure::Exception(); 5033 if (boilerplate.is_null()) return Failure::Exception();
5028 Handle<JSFunction> compiled_function = 5034 Handle<JSFunction> compiled_function =
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after
5447 5453
5448 void Runtime::PerformGC(Object* result) { 5454 void Runtime::PerformGC(Object* result) {
5449 Failure* failure = Failure::cast(result); 5455 Failure* failure = Failure::cast(result);
5450 // Try to do a garbage collection; ignore it if it fails. The C 5456 // Try to do a garbage collection; ignore it if it fails. The C
5451 // entry stub will throw an out-of-memory exception in that case. 5457 // entry stub will throw an out-of-memory exception in that case.
5452 Heap::CollectGarbage(failure->requested(), failure->allocation_space()); 5458 Heap::CollectGarbage(failure->requested(), failure->allocation_space());
5453 } 5459 }
5454 5460
5455 5461
5456 } } // namespace v8::internal 5462 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/runtime.h ('k') | src/serialize.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698