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

Side by Side Diff: src/objects.cc

Issue 1196223002: Do not look for existing shared function info when compiling a new script. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 6 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
« no previous file with comments | « src/compiler.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <iomanip> 5 #include <iomanip>
6 #include <sstream> 6 #include <sstream>
7 7
8 #include "src/v8.h" 8 #include "src/v8.h"
9 9
10 #include "src/accessors.h" 10 #include "src/accessors.h"
(...skipping 10418 matching lines...) Expand 10 before | Expand all | Expand 10 after
10429 10429
10430 MaybeHandle<SharedFunctionInfo> Script::FindSharedFunctionInfo( 10430 MaybeHandle<SharedFunctionInfo> Script::FindSharedFunctionInfo(
10431 FunctionLiteral* fun) { 10431 FunctionLiteral* fun) {
10432 if (shared_function_infos()->IsWeakFixedArray()) { 10432 if (shared_function_infos()->IsWeakFixedArray()) {
10433 WeakFixedArray* array = WeakFixedArray::cast(shared_function_infos()); 10433 WeakFixedArray* array = WeakFixedArray::cast(shared_function_infos());
10434 for (int i = 0; i < array->Length(); i++) { 10434 for (int i = 0; i < array->Length(); i++) {
10435 Object* obj = array->Get(i); 10435 Object* obj = array->Get(i);
10436 if (!obj->IsSharedFunctionInfo()) continue; 10436 if (!obj->IsSharedFunctionInfo()) continue;
10437 SharedFunctionInfo* shared = SharedFunctionInfo::cast(obj); 10437 SharedFunctionInfo* shared = SharedFunctionInfo::cast(obj);
10438 if (fun->function_token_position() == shared->function_token_position() && 10438 if (fun->function_token_position() == shared->function_token_position() &&
10439 fun->start_position() == shared->start_position() && 10439 fun->start_position() == shared->start_position()) {
10440 fun->end_position() == shared->end_position()) {
10441 return Handle<SharedFunctionInfo>(shared); 10440 return Handle<SharedFunctionInfo>(shared);
10442 } 10441 }
10443 } 10442 }
10444 } 10443 }
10445 return MaybeHandle<SharedFunctionInfo>(); 10444 return MaybeHandle<SharedFunctionInfo>();
10446 } 10445 }
10447 10446
10448 10447
10449 void SharedFunctionInfo::SetScript(Handle<SharedFunctionInfo> shared, 10448 void SharedFunctionInfo::SetScript(Handle<SharedFunctionInfo> shared,
10450 Handle<Object> script_object) { 10449 Handle<Object> script_object) {
10451 if (shared->script() == *script_object) return; 10450 if (shared->script() == *script_object) return;
10452 // Remove shared function info from old script's list. 10451 // Remove shared function info from old script's list.
10453 if (shared->script()->IsScript()) { 10452 if (shared->script()->IsScript()) {
10454 Script* old_script = Script::cast(shared->script()); 10453 Script* old_script = Script::cast(shared->script());
10455 if (old_script->shared_function_infos()->IsWeakFixedArray()) { 10454 if (old_script->shared_function_infos()->IsWeakFixedArray()) {
10456 WeakFixedArray* list = 10455 WeakFixedArray* list =
10457 WeakFixedArray::cast(old_script->shared_function_infos()); 10456 WeakFixedArray::cast(old_script->shared_function_infos());
10458 list->Remove(shared); 10457 list->Remove(shared);
10459 } 10458 }
10460 } 10459 }
10461 // Add shared function info to new script's list. 10460 // Add shared function info to new script's list.
10462 if (script_object->IsScript()) { 10461 if (script_object->IsScript()) {
10463 Handle<Script> script = Handle<Script>::cast(script_object); 10462 Handle<Script> script = Handle<Script>::cast(script_object);
10463 Handle<Object> list(script->shared_function_infos(), shared->GetIsolate());
10464 #ifdef DEBUG
10464 bool found = false; 10465 bool found = false;
10465 Handle<Object> list(script->shared_function_infos(), shared->GetIsolate());
10466 list = WeakFixedArray::Add(list, shared, WeakFixedArray::kAddIfNotFound, 10466 list = WeakFixedArray::Add(list, shared, WeakFixedArray::kAddIfNotFound,
10467 &found); 10467 &found);
10468 CHECK(!found); 10468 CHECK(!found);
10469 #else
10470 list = WeakFixedArray::Add(list, shared, WeakFixedArray::kAlwaysAdd);
10471 #endif // DEBUG
10469 script->set_shared_function_infos(*list); 10472 script->set_shared_function_infos(*list);
10470 } 10473 }
10471 // Finally set new script. 10474 // Finally set new script.
10472 shared->set_script(*script_object); 10475 shared->set_script(*script_object);
10473 } 10476 }
10474 10477
10475 10478
10476 String* SharedFunctionInfo::DebugName() { 10479 String* SharedFunctionInfo::DebugName() {
10477 Object* n = name(); 10480 Object* n = name();
10478 if (!n->IsString() || String::cast(n)->length() == 0) return inferred_name(); 10481 if (!n->IsString() || String::cast(n)->length() == 0) return inferred_name();
(...skipping 6201 matching lines...) Expand 10 before | Expand all | Expand 10 after
16680 Handle<Object> new_value) { 16683 Handle<Object> new_value) {
16681 if (cell->value() != *new_value) { 16684 if (cell->value() != *new_value) {
16682 cell->set_value(*new_value); 16685 cell->set_value(*new_value);
16683 Isolate* isolate = cell->GetIsolate(); 16686 Isolate* isolate = cell->GetIsolate();
16684 cell->dependent_code()->DeoptimizeDependentCodeGroup( 16687 cell->dependent_code()->DeoptimizeDependentCodeGroup(
16685 isolate, DependentCode::kPropertyCellChangedGroup); 16688 isolate, DependentCode::kPropertyCellChangedGroup);
16686 } 16689 }
16687 } 16690 }
16688 } // namespace internal 16691 } // namespace internal
16689 } // namespace v8 16692 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698