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

Side by Side Diff: src/handles.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/handles.h ('k') | src/heap.h » ('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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 CALL_HEAP_FUNCTION(content->AddKeysFromJSArray(*array), FixedArray); 55 CALL_HEAP_FUNCTION(content->AddKeysFromJSArray(*array), FixedArray);
56 } 56 }
57 57
58 58
59 Handle<FixedArray> UnionOfKeys(Handle<FixedArray> first, 59 Handle<FixedArray> UnionOfKeys(Handle<FixedArray> first,
60 Handle<FixedArray> second) { 60 Handle<FixedArray> second) {
61 CALL_HEAP_FUNCTION(first->UnionOfKeys(*second), FixedArray); 61 CALL_HEAP_FUNCTION(first->UnionOfKeys(*second), FixedArray);
62 } 62 }
63 63
64 64
65 Handle<JSGlobalObject> ReinitializeJSGlobalObject( 65 Handle<JSGlobalProxy> ReinitializeJSGlobalProxy(
66 Handle<JSFunction> constructor, 66 Handle<JSFunction> constructor,
67 Handle<JSGlobalObject> global) { 67 Handle<JSGlobalProxy> global) {
68 CALL_HEAP_FUNCTION(Heap::ReinitializeJSGlobalObject(*constructor, *global), 68 CALL_HEAP_FUNCTION(Heap::ReinitializeJSGlobalProxy(*constructor, *global),
69 JSGlobalObject); 69 JSGlobalProxy);
70 } 70 }
71 71
72 72
73 void SetExpectedNofProperties(Handle<JSFunction> func, int nof) { 73 void SetExpectedNofProperties(Handle<JSFunction> func, int nof) {
74 func->shared()->set_expected_nof_properties(nof); 74 func->shared()->set_expected_nof_properties(nof);
75 if (func->has_initial_map()) { 75 if (func->has_initial_map()) {
76 Handle<Map> new_initial_map = 76 Handle<Map> new_initial_map =
77 Factory::CopyMapDropTransitions(Handle<Map>(func->initial_map())); 77 Factory::CopyMapDropTransitions(Handle<Map>(func->initial_map()));
78 new_initial_map->set_unused_property_fields(nof); 78 new_initial_map->set_unused_property_fields(nof);
79 func->set_initial_map(*new_initial_map); 79 func->set_initial_map(*new_initial_map);
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
478 } 478 }
479 479
480 480
481 void LoadLazy(Handle<JSFunction> fun, bool* pending_exception) { 481 void LoadLazy(Handle<JSFunction> fun, bool* pending_exception) {
482 HandleScope scope; 482 HandleScope scope;
483 Handle<FixedArray> info(FixedArray::cast(fun->shared()->lazy_load_data())); 483 Handle<FixedArray> info(FixedArray::cast(fun->shared()->lazy_load_data()));
484 int index = Smi::cast(info->get(0))->value(); 484 int index = Smi::cast(info->get(0))->value();
485 ASSERT(index >= 0); 485 ASSERT(index >= 0);
486 Handle<Context> compile_context(Context::cast(info->get(1))); 486 Handle<Context> compile_context(Context::cast(info->get(1)));
487 Handle<Context> function_context(Context::cast(info->get(2))); 487 Handle<Context> function_context(Context::cast(info->get(2)));
488 Handle<Context> security_context(Context::cast(info->get(3)));
489 Handle<Object> receiver(compile_context->global()->builtins()); 488 Handle<Object> receiver(compile_context->global()->builtins());
490 489
491 Vector<const char> name = Natives::GetScriptName(index); 490 Vector<const char> name = Natives::GetScriptName(index);
492 491
493 Handle<JSFunction> boilerplate; 492 Handle<JSFunction> boilerplate;
494 493
495 if (!Bootstrapper::NativesCacheLookup(name, &boilerplate)) { 494 if (!Bootstrapper::NativesCacheLookup(name, &boilerplate)) {
496 Handle<String> source_code = Bootstrapper::NativesSourceLookup(index); 495 Handle<String> source_code = Bootstrapper::NativesSourceLookup(index);
497 Handle<String> script_name = Factory::NewStringFromAscii(name); 496 Handle<String> script_name = Factory::NewStringFromAscii(name);
498 bool allow_natives_syntax = FLAG_allow_natives_syntax; 497 bool allow_natives_syntax = FLAG_allow_natives_syntax;
(...skipping 14 matching lines...) Expand all
513 // We shouldn't get here if compiling the script failed. 512 // We shouldn't get here if compiling the script failed.
514 ASSERT(!boilerplate.is_null()); 513 ASSERT(!boilerplate.is_null());
515 514
516 // When the debugger running in its own context touches lazy loaded 515 // When the debugger running in its own context touches lazy loaded
517 // functions loading can be triggered. In that case ensure that the 516 // functions loading can be triggered. In that case ensure that the
518 // execution of the boilerplate is in the correct context. 517 // execution of the boilerplate is in the correct context.
519 SaveContext save; 518 SaveContext save;
520 if (!Debug::debug_context().is_null() && 519 if (!Debug::debug_context().is_null() &&
521 Top::context() == *Debug::debug_context()) { 520 Top::context() == *Debug::debug_context()) {
522 Top::set_context(*compile_context); 521 Top::set_context(*compile_context);
523 Top::set_security_context(*security_context);
524 } 522 }
525 523
526 // Reset the lazy load data before running the script to make sure 524 // Reset the lazy load data before running the script to make sure
527 // not to get recursive lazy loading. 525 // not to get recursive lazy loading.
528 fun->shared()->set_lazy_load_data(Heap::undefined_value()); 526 fun->shared()->set_lazy_load_data(Heap::undefined_value());
529 527
530 // Run the script. 528 // Run the script.
531 Handle<JSFunction> script_fun( 529 Handle<JSFunction> script_fun(
532 Factory::NewFunctionFromBoilerplate(boilerplate, function_context)); 530 Factory::NewFunctionFromBoilerplate(boilerplate, function_context));
533 Execution::Call(script_fun, receiver, 0, NULL, pending_exception); 531 Execution::Call(script_fun, receiver, 0, NULL, pending_exception);
534 532
535 // If lazy loading failed, restore the unloaded state of fun. 533 // If lazy loading failed, restore the unloaded state of fun.
536 if (*pending_exception) fun->shared()->set_lazy_load_data(*info); 534 if (*pending_exception) fun->shared()->set_lazy_load_data(*info);
537 } 535 }
538 536
539 537
540 void SetupLazy(Handle<JSFunction> fun, 538 void SetupLazy(Handle<JSFunction> fun,
541 int index, 539 int index,
542 Handle<Context> compile_context, 540 Handle<Context> compile_context,
543 Handle<Context> function_context, 541 Handle<Context> function_context) {
544 Handle<Context> security_context) { 542 Handle<FixedArray> arr = Factory::NewFixedArray(3);
545 Handle<FixedArray> arr = Factory::NewFixedArray(4);
546 arr->set(0, Smi::FromInt(index)); 543 arr->set(0, Smi::FromInt(index));
547 arr->set(1, *compile_context); // Compile in this context 544 arr->set(1, *compile_context); // Compile in this context
548 arr->set(2, *function_context); // Set function context to this 545 arr->set(2, *function_context); // Set function context to this
549 arr->set(3, *security_context); // Receiver for call
550 fun->shared()->set_lazy_load_data(*arr); 546 fun->shared()->set_lazy_load_data(*arr);
551 } 547 }
552 548
553 } } // namespace v8::internal 549 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/handles.h ('k') | src/heap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698