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

Side by Side Diff: src/compiler.cc

Issue 3398014: Fix possible evaluation order problems. (Closed)
Patch Set: fixed more places Created 10 years, 3 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
OLDNEW
1 // Copyright 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 if (!ava.Analyze()) return Handle<Code>::null(); 113 if (!ava.Analyze()) return Handle<Code>::null();
114 return CodeGenerator::MakeCode(info); 114 return CodeGenerator::MakeCode(info);
115 } 115 }
116 116
117 117
118 #ifdef ENABLE_DEBUGGER_SUPPORT 118 #ifdef ENABLE_DEBUGGER_SUPPORT
119 Handle<Code> MakeCodeForLiveEdit(CompilationInfo* info) { 119 Handle<Code> MakeCodeForLiveEdit(CompilationInfo* info) {
120 Handle<Context> context = Handle<Context>::null(); 120 Handle<Context> context = Handle<Context>::null();
121 Handle<Code> code = MakeCode(context, info); 121 Handle<Code> code = MakeCode(context, info);
122 if (!info->shared_info().is_null()) { 122 if (!info->shared_info().is_null()) {
123 info->shared_info()->set_scope_info( 123 Handle<SerializedScopeInfo> scope_info =
124 *SerializedScopeInfo::Create(info->scope())); 124 SerializedScopeInfo::Create(info->scope());
125 info->shared_info()->set_scope_info(*scope_info);
125 } 126 }
126 return code; 127 return code;
127 } 128 }
128 #endif 129 #endif
129 130
130 131
131 static Handle<SharedFunctionInfo> MakeFunctionInfo(bool is_global, 132 static Handle<SharedFunctionInfo> MakeFunctionInfo(bool is_global,
132 bool is_eval, 133 bool is_eval,
133 Compiler::ValidationState validate, 134 Compiler::ValidationState validate,
134 Handle<Script> script, 135 Handle<Script> script,
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 414
414 RecordFunctionCompilation(Logger::LAZY_COMPILE_TAG, 415 RecordFunctionCompilation(Logger::LAZY_COMPILE_TAG,
415 name, 416 name,
416 Handle<String>(shared->inferred_name()), 417 Handle<String>(shared->inferred_name()),
417 start_position, 418 start_position,
418 info->script(), 419 info->script(),
419 code); 420 code);
420 421
421 // Update the shared function info with the compiled code and the scope info. 422 // Update the shared function info with the compiled code and the scope info.
422 // Please note, that the order of the sharedfunction initialization is 423 // Please note, that the order of the sharedfunction initialization is
423 // important since set_scope_info might trigger a GC, causing the ASSERT 424 // important since SerializedScopeInfo::Create might trigger a GC, causing
424 // below to be invalid if the code was flushed. By settting the code 425 // the ASSERT below to be invalid if the code was flushed. By setting the code
425 // object last we avoid this. 426 // object last we avoid this.
426 shared->set_scope_info(*SerializedScopeInfo::Create(info->scope())); 427 Handle<SerializedScopeInfo> scope_info =
428 SerializedScopeInfo::Create(info->scope());
429 shared->set_scope_info(*scope_info);
427 shared->set_code(*code); 430 shared->set_code(*code);
428 if (!info->closure().is_null()) { 431 if (!info->closure().is_null()) {
429 info->closure()->set_code(*code); 432 info->closure()->set_code(*code);
430 } 433 }
431 434
432 // Set the expected number of properties for instances. 435 // Set the expected number of properties for instances.
433 SetExpectedNofPropertiesFromEstimate(shared, lit->expected_property_count()); 436 SetExpectedNofPropertiesFromEstimate(shared, lit->expected_property_count());
434 437
435 // Set the optimication hints after performing lazy compilation, as these are 438 // Set the optimication hints after performing lazy compilation, as these are
436 // not set when the function is set up as a lazily compiled function. 439 // not set when the function is set up as a lazily compiled function.
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
578 PROFILE(CodeCreateEvent(Logger::ToNativeByScript(tag, *script), 581 PROFILE(CodeCreateEvent(Logger::ToNativeByScript(tag, *script),
579 *code, *func_name)); 582 *code, *func_name));
580 OPROFILE(CreateNativeCodeRegion(*func_name, 583 OPROFILE(CreateNativeCodeRegion(*func_name,
581 code->instruction_start(), 584 code->instruction_start(),
582 code->instruction_size())); 585 code->instruction_size()));
583 } 586 }
584 } 587 }
585 } 588 }
586 589
587 } } // namespace v8::internal 590 } } // namespace v8::internal
OLDNEW
« src/bootstrapper.cc ('K') | « src/compilation-cache.cc ('k') | src/handles.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698