OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 "v8.h" | 5 #include "v8.h" |
6 | 6 |
7 #include "compiler.h" | 7 #include "compiler.h" |
8 | 8 |
9 #include "bootstrapper.h" | 9 #include "bootstrapper.h" |
10 #include "codegen.h" | 10 #include "codegen.h" |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 for (int i = 0; i < DependentCode::kGroupCount; i++) { | 104 for (int i = 0; i < DependentCode::kGroupCount; i++) { |
105 dependencies_[i] = NULL; | 105 dependencies_[i] = NULL; |
106 } | 106 } |
107 if (mode == STUB) { | 107 if (mode == STUB) { |
108 mode_ = STUB; | 108 mode_ = STUB; |
109 return; | 109 return; |
110 } | 110 } |
111 mode_ = mode; | 111 mode_ = mode; |
112 abort_due_to_dependency_ = false; | 112 abort_due_to_dependency_ = false; |
113 if (script_->type()->value() == Script::TYPE_NATIVE) MarkAsNative(); | 113 if (script_->type()->value() == Script::TYPE_NATIVE) MarkAsNative(); |
114 if (isolate_->debugger()->is_active()) MarkAsDebug(); | 114 if (isolate_->debug()->is_active()) MarkAsDebug(); |
115 | 115 |
116 if (!shared_info_.is_null()) { | 116 if (!shared_info_.is_null()) { |
117 ASSERT(strict_mode() == SLOPPY); | 117 ASSERT(strict_mode() == SLOPPY); |
118 SetStrictMode(shared_info_->strict_mode()); | 118 SetStrictMode(shared_info_->strict_mode()); |
119 } | 119 } |
120 set_bailout_reason(kUnknown); | 120 set_bailout_reason(kUnknown); |
121 | 121 |
122 if (!shared_info().is_null() && shared_info()->is_compiled()) { | 122 if (!shared_info().is_null() && shared_info()->is_compiled()) { |
123 // We should initialize the CompilationInfo feedback vector from the | 123 // We should initialize the CompilationInfo feedback vector from the |
124 // passed in shared info, rather than creating a new one. | 124 // passed in shared info, rather than creating a new one. |
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
765 static Handle<SharedFunctionInfo> CompileToplevel(CompilationInfo* info) { | 765 static Handle<SharedFunctionInfo> CompileToplevel(CompilationInfo* info) { |
766 Isolate* isolate = info->isolate(); | 766 Isolate* isolate = info->isolate(); |
767 PostponeInterruptsScope postpone(isolate); | 767 PostponeInterruptsScope postpone(isolate); |
768 ASSERT(!isolate->native_context().is_null()); | 768 ASSERT(!isolate->native_context().is_null()); |
769 Handle<Script> script = info->script(); | 769 Handle<Script> script = info->script(); |
770 | 770 |
771 // TODO(svenpanne) Obscure place for this, perhaps move to OnBeforeCompile? | 771 // TODO(svenpanne) Obscure place for this, perhaps move to OnBeforeCompile? |
772 FixedArray* array = isolate->native_context()->embedder_data(); | 772 FixedArray* array = isolate->native_context()->embedder_data(); |
773 script->set_context_data(array->get(0)); | 773 script->set_context_data(array->get(0)); |
774 | 774 |
775 isolate->debugger()->OnBeforeCompile(script); | 775 isolate->debug()->OnBeforeCompile(script); |
776 | 776 |
777 ASSERT(info->is_eval() || info->is_global()); | 777 ASSERT(info->is_eval() || info->is_global()); |
778 | 778 |
779 bool parse_allow_lazy = | 779 bool parse_allow_lazy = |
780 (info->cached_data_mode() == CONSUME_CACHED_DATA || | 780 (info->cached_data_mode() == CONSUME_CACHED_DATA || |
781 String::cast(script->source())->length() > FLAG_min_preparse_length) && | 781 String::cast(script->source())->length() > FLAG_min_preparse_length) && |
782 !DebuggerWantsEagerCompilation(info); | 782 !DebuggerWantsEagerCompilation(info); |
783 | 783 |
784 if (!parse_allow_lazy && info->cached_data_mode() != NO_CACHED_DATA) { | 784 if (!parse_allow_lazy && info->cached_data_mode() != NO_CACHED_DATA) { |
785 // We are going to parse eagerly, but we either 1) have cached data produced | 785 // We are going to parse eagerly, but we either 1) have cached data produced |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
842 // property space by setting the expected number of properties for | 842 // property space by setting the expected number of properties for |
843 // the instances of the function. | 843 // the instances of the function. |
844 SetExpectedNofPropertiesFromEstimate(result, | 844 SetExpectedNofPropertiesFromEstimate(result, |
845 lit->expected_property_count()); | 845 lit->expected_property_count()); |
846 | 846 |
847 script->set_compilation_state(Script::COMPILATION_STATE_COMPILED); | 847 script->set_compilation_state(Script::COMPILATION_STATE_COMPILED); |
848 | 848 |
849 live_edit_tracker.RecordFunctionInfo(result, lit, info->zone()); | 849 live_edit_tracker.RecordFunctionInfo(result, lit, info->zone()); |
850 } | 850 } |
851 | 851 |
852 isolate->debugger()->OnAfterCompile(script, Debugger::NO_AFTER_COMPILE_FLAGS); | 852 isolate->debug()->OnAfterCompile(script, Debug::NO_AFTER_COMPILE_FLAGS); |
853 | 853 |
854 return result; | 854 return result; |
855 } | 855 } |
856 | 856 |
857 | 857 |
858 MaybeHandle<JSFunction> Compiler::GetFunctionFromEval( | 858 MaybeHandle<JSFunction> Compiler::GetFunctionFromEval( |
859 Handle<String> source, | 859 Handle<String> source, |
860 Handle<Context> context, | 860 Handle<Context> context, |
861 StrictMode strict_mode, | 861 StrictMode strict_mode, |
862 ParseRestriction restriction, | 862 ParseRestriction restriction, |
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1296 AllowHandleDereference allow_deref; | 1296 AllowHandleDereference allow_deref; |
1297 bool tracing_on = info()->IsStub() | 1297 bool tracing_on = info()->IsStub() |
1298 ? FLAG_trace_hydrogen_stubs | 1298 ? FLAG_trace_hydrogen_stubs |
1299 : (FLAG_trace_hydrogen && | 1299 : (FLAG_trace_hydrogen && |
1300 info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter)); | 1300 info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter)); |
1301 return (tracing_on && | 1301 return (tracing_on && |
1302 OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL); | 1302 OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL); |
1303 } | 1303 } |
1304 | 1304 |
1305 } } // namespace v8::internal | 1305 } } // namespace v8::internal |
OLD | NEW |