| OLD | NEW |
| 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 "src/objects.h" | 5 #include "src/objects.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 #include <iomanip> | 8 #include <iomanip> |
| 9 #include <sstream> | 9 #include <sstream> |
| 10 | 10 |
| (...skipping 10116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10127 PrintF(" ** Marking "); | 10127 PrintF(" ** Marking "); |
| 10128 ShortPrint(); | 10128 ShortPrint(); |
| 10129 PrintF(" for concurrent recompilation.\n"); | 10129 PrintF(" for concurrent recompilation.\n"); |
| 10130 } | 10130 } |
| 10131 set_code_no_write_barrier( | 10131 set_code_no_write_barrier( |
| 10132 isolate->builtins()->builtin(Builtins::kCompileOptimizedConcurrent)); | 10132 isolate->builtins()->builtin(Builtins::kCompileOptimizedConcurrent)); |
| 10133 // No write barrier required, since the builtin is part of the root set. | 10133 // No write barrier required, since the builtin is part of the root set. |
| 10134 } | 10134 } |
| 10135 | 10135 |
| 10136 | 10136 |
| 10137 Handle<JSFunction> JSFunction::CloneClosure(Handle<JSFunction> function) { | |
| 10138 Isolate* isolate = function->GetIsolate(); | |
| 10139 Handle<Map> map(function->map()); | |
| 10140 Handle<SharedFunctionInfo> shared(function->shared()); | |
| 10141 Handle<Context> context(function->context()); | |
| 10142 Handle<JSFunction> clone = | |
| 10143 isolate->factory()->NewFunctionFromSharedFunctionInfo(shared, context); | |
| 10144 | |
| 10145 if (shared->bound()) { | |
| 10146 clone->set_function_bindings(function->function_bindings()); | |
| 10147 } | |
| 10148 | |
| 10149 // In typical case, __proto__ of ``function`` is the default Function | |
| 10150 // prototype, which means that SetPrototype below is a no-op. | |
| 10151 // In rare cases when that is not true, we mutate the clone's __proto__. | |
| 10152 Handle<Object> original_prototype(map->prototype(), isolate); | |
| 10153 if (*original_prototype != clone->map()->prototype()) { | |
| 10154 JSObject::SetPrototype(clone, original_prototype, false).Assert(); | |
| 10155 } | |
| 10156 | |
| 10157 return clone; | |
| 10158 } | |
| 10159 | |
| 10160 | |
| 10161 void SharedFunctionInfo::AddSharedCodeToOptimizedCodeMap( | 10137 void SharedFunctionInfo::AddSharedCodeToOptimizedCodeMap( |
| 10162 Handle<SharedFunctionInfo> shared, Handle<Code> code) { | 10138 Handle<SharedFunctionInfo> shared, Handle<Code> code) { |
| 10163 Isolate* isolate = shared->GetIsolate(); | 10139 Isolate* isolate = shared->GetIsolate(); |
| 10164 DCHECK(code->kind() == Code::OPTIMIZED_FUNCTION); | 10140 DCHECK(code->kind() == Code::OPTIMIZED_FUNCTION); |
| 10165 Handle<Object> value(shared->optimized_code_map(), isolate); | 10141 Handle<Object> value(shared->optimized_code_map(), isolate); |
| 10166 if (value->IsSmi()) return; // Empty code maps are unsupported. | 10142 if (value->IsSmi()) return; // Empty code maps are unsupported. |
| 10167 Handle<FixedArray> code_map = Handle<FixedArray>::cast(value); | 10143 Handle<FixedArray> code_map = Handle<FixedArray>::cast(value); |
| 10168 code_map->set(kSharedCodeIndex, *code); | 10144 code_map->set(kSharedCodeIndex, *code); |
| 10169 } | 10145 } |
| 10170 | 10146 |
| (...skipping 6598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 16769 if (cell->value() != *new_value) { | 16745 if (cell->value() != *new_value) { |
| 16770 cell->set_value(*new_value); | 16746 cell->set_value(*new_value); |
| 16771 Isolate* isolate = cell->GetIsolate(); | 16747 Isolate* isolate = cell->GetIsolate(); |
| 16772 cell->dependent_code()->DeoptimizeDependentCodeGroup( | 16748 cell->dependent_code()->DeoptimizeDependentCodeGroup( |
| 16773 isolate, DependentCode::kPropertyCellChangedGroup); | 16749 isolate, DependentCode::kPropertyCellChangedGroup); |
| 16774 } | 16750 } |
| 16775 } | 16751 } |
| 16776 | 16752 |
| 16777 } // namespace internal | 16753 } // namespace internal |
| 16778 } // namespace v8 | 16754 } // namespace v8 |
| OLD | NEW |