| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 9121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9132 | 9132 |
| 9133 void JSFunction::JSFunctionIterateBody(int object_size, ObjectVisitor* v) { | 9133 void JSFunction::JSFunctionIterateBody(int object_size, ObjectVisitor* v) { |
| 9134 // Iterate over all fields in the body but take care in dealing with | 9134 // Iterate over all fields in the body but take care in dealing with |
| 9135 // the code entry. | 9135 // the code entry. |
| 9136 IteratePointers(v, kPropertiesOffset, kCodeEntryOffset); | 9136 IteratePointers(v, kPropertiesOffset, kCodeEntryOffset); |
| 9137 v->VisitCodeEntry(this->address() + kCodeEntryOffset); | 9137 v->VisitCodeEntry(this->address() + kCodeEntryOffset); |
| 9138 IteratePointers(v, kCodeEntryOffset + kPointerSize, object_size); | 9138 IteratePointers(v, kCodeEntryOffset + kPointerSize, object_size); |
| 9139 } | 9139 } |
| 9140 | 9140 |
| 9141 | 9141 |
| 9142 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 9143 #define ASSERT_UNLESS_DEBUG_BREAKPOINTS(assert) \ |
| 9144 ASSERT((assert) || GetIsolate()->debug()->has_break_points()); |
| 9145 #else |
| 9146 #define ASSERT_UNLESS_DEBUG_BREAKPOINTS(assert) \ |
| 9147 ASSERT((assert)); |
| 9148 #endif // ENABLE_DEBUGGER_SUPPORT |
| 9149 |
| 9150 |
| 9142 void JSFunction::MarkForLazyRecompilation() { | 9151 void JSFunction::MarkForLazyRecompilation() { |
| 9143 ASSERT(is_compiled() || GetIsolate()->debugger()->IsDebuggerActive()); | 9152 ASSERT_UNLESS_DEBUG_BREAKPOINTS(is_compiled()); |
| 9144 ASSERT(!IsOptimized()); | 9153 ASSERT(!IsOptimized()); |
| 9145 ASSERT(shared()->allows_lazy_compilation() || | 9154 ASSERT(shared()->allows_lazy_compilation() || |
| 9146 code()->optimizable()); | 9155 code()->optimizable()); |
| 9147 set_code_no_write_barrier( | 9156 set_code_no_write_barrier( |
| 9148 GetIsolate()->builtins()->builtin(Builtins::kLazyRecompile)); | 9157 GetIsolate()->builtins()->builtin(Builtins::kLazyRecompile)); |
| 9149 // No write barrier required, since the builtin is part of the root set. | 9158 // No write barrier required, since the builtin is part of the root set. |
| 9150 } | 9159 } |
| 9151 | 9160 |
| 9152 | 9161 |
| 9153 void JSFunction::MarkForParallelRecompilation() { | 9162 void JSFunction::MarkForParallelRecompilation() { |
| 9154 ASSERT(is_compiled() || GetIsolate()->debugger()->IsDebuggerActive()); | 9163 ASSERT_UNLESS_DEBUG_BREAKPOINTS(is_compiled()); |
| 9155 ASSERT(!IsOptimized()); | 9164 ASSERT(!IsOptimized()); |
| 9156 ASSERT(shared()->allows_lazy_compilation() || code()->optimizable()); | 9165 ASSERT(shared()->allows_lazy_compilation() || code()->optimizable()); |
| 9157 if (!FLAG_parallel_recompilation) { | 9166 if (!FLAG_parallel_recompilation) { |
| 9158 JSFunction::MarkForLazyRecompilation(); | 9167 JSFunction::MarkForLazyRecompilation(); |
| 9159 return; | 9168 return; |
| 9160 } | 9169 } |
| 9161 if (FLAG_trace_parallel_recompilation) { | 9170 if (FLAG_trace_parallel_recompilation) { |
| 9162 PrintF(" ** Marking "); | 9171 PrintF(" ** Marking "); |
| 9163 PrintName(); | 9172 PrintName(); |
| 9164 PrintF(" for parallel recompilation.\n"); | 9173 PrintF(" for parallel recompilation.\n"); |
| 9165 } | 9174 } |
| 9166 set_code_no_write_barrier( | 9175 set_code_no_write_barrier( |
| 9167 GetIsolate()->builtins()->builtin(Builtins::kParallelRecompile)); | 9176 GetIsolate()->builtins()->builtin(Builtins::kParallelRecompile)); |
| 9168 // No write barrier required, since the builtin is part of the root set. | 9177 // No write barrier required, since the builtin is part of the root set. |
| 9169 } | 9178 } |
| 9170 | 9179 |
| 9171 | 9180 |
| 9172 void JSFunction::MarkForInstallingRecompiledCode() { | 9181 void JSFunction::MarkForInstallingRecompiledCode() { |
| 9173 ASSERT(is_compiled() || GetIsolate()->debugger()->IsDebuggerActive()); | 9182 ASSERT_UNLESS_DEBUG_BREAKPOINTS(IsInRecompileQueue()); |
| 9174 ASSERT(!IsOptimized()); | 9183 ASSERT(!IsOptimized()); |
| 9175 ASSERT(shared()->allows_lazy_compilation() || code()->optimizable()); | 9184 ASSERT(shared()->allows_lazy_compilation() || code()->optimizable()); |
| 9176 ASSERT(FLAG_parallel_recompilation); | 9185 ASSERT(FLAG_parallel_recompilation); |
| 9177 set_code_no_write_barrier( | 9186 set_code_no_write_barrier( |
| 9178 GetIsolate()->builtins()->builtin(Builtins::kInstallRecompiledCode)); | 9187 GetIsolate()->builtins()->builtin(Builtins::kInstallRecompiledCode)); |
| 9179 // No write barrier required, since the builtin is part of the root set. | 9188 // No write barrier required, since the builtin is part of the root set. |
| 9180 } | 9189 } |
| 9181 | 9190 |
| 9182 | 9191 |
| 9183 void JSFunction::MarkInRecompileQueue() { | 9192 void JSFunction::MarkInRecompileQueue() { |
| 9184 ASSERT(is_compiled() || GetIsolate()->debugger()->IsDebuggerActive()); | 9193 ASSERT_UNLESS_DEBUG_BREAKPOINTS(IsMarkedForParallelRecompilation()); |
| 9185 ASSERT(!IsOptimized()); | 9194 ASSERT(!IsOptimized()); |
| 9186 ASSERT(shared()->allows_lazy_compilation() || code()->optimizable()); | 9195 ASSERT(shared()->allows_lazy_compilation() || code()->optimizable()); |
| 9187 ASSERT(FLAG_parallel_recompilation); | 9196 ASSERT(FLAG_parallel_recompilation); |
| 9188 if (FLAG_trace_parallel_recompilation) { | 9197 if (FLAG_trace_parallel_recompilation) { |
| 9189 PrintF(" ** Queueing "); | 9198 PrintF(" ** Queueing "); |
| 9190 PrintName(); | 9199 PrintName(); |
| 9191 PrintF(" for parallel recompilation.\n"); | 9200 PrintF(" for parallel recompilation.\n"); |
| 9192 } | 9201 } |
| 9193 set_code_no_write_barrier( | 9202 set_code_no_write_barrier( |
| 9194 GetIsolate()->builtins()->builtin(Builtins::kInRecompileQueue)); | 9203 GetIsolate()->builtins()->builtin(Builtins::kInRecompileQueue)); |
| 9195 // No write barrier required, since the builtin is part of the root set. | 9204 // No write barrier required, since the builtin is part of the root set. |
| 9196 } | 9205 } |
| 9197 | 9206 |
| 9198 | 9207 |
| 9208 #undef ASSERT_UNLESS_DEBUG_BREAKPOINTS |
| 9209 |
| 9210 |
| 9199 static bool CompileLazyHelper(CompilationInfo* info, | 9211 static bool CompileLazyHelper(CompilationInfo* info, |
| 9200 ClearExceptionFlag flag) { | 9212 ClearExceptionFlag flag) { |
| 9201 // Compile the source information to a code object. | 9213 // Compile the source information to a code object. |
| 9202 ASSERT(info->IsOptimizing() || !info->shared_info()->is_compiled()); | 9214 ASSERT(info->IsOptimizing() || !info->shared_info()->is_compiled()); |
| 9203 ASSERT(!info->isolate()->has_pending_exception()); | 9215 ASSERT(!info->isolate()->has_pending_exception()); |
| 9204 bool result = Compiler::CompileLazy(info); | 9216 bool result = Compiler::CompileLazy(info); |
| 9205 ASSERT(result != Isolate::Current()->has_pending_exception()); | 9217 ASSERT(result != Isolate::Current()->has_pending_exception()); |
| 9206 if (!result && flag == CLEAR_EXCEPTION) { | 9218 if (!result && flag == CLEAR_EXCEPTION) { |
| 9207 info->isolate()->clear_pending_exception(); | 9219 info->isolate()->clear_pending_exception(); |
| 9208 } | 9220 } |
| (...skipping 6610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15819 | 15831 |
| 15820 void PropertyCell::AddDependentCode(Handle<Code> code) { | 15832 void PropertyCell::AddDependentCode(Handle<Code> code) { |
| 15821 Handle<DependentCode> codes = DependentCode::Insert( | 15833 Handle<DependentCode> codes = DependentCode::Insert( |
| 15822 Handle<DependentCode>(dependent_code()), | 15834 Handle<DependentCode>(dependent_code()), |
| 15823 DependentCode::kPropertyCellChangedGroup, code); | 15835 DependentCode::kPropertyCellChangedGroup, code); |
| 15824 if (*codes != dependent_code()) set_dependent_code(*codes); | 15836 if (*codes != dependent_code()) set_dependent_code(*codes); |
| 15825 } | 15837 } |
| 15826 | 15838 |
| 15827 | 15839 |
| 15828 } } // namespace v8::internal | 15840 } } // namespace v8::internal |
| OLD | NEW |