Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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/runtime/runtime-utils.h" | 5 #include "src/runtime/runtime-utils.h" |
| 6 | 6 |
| 7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
| 8 #include "src/arguments.h" | 8 #include "src/arguments.h" |
| 9 #include "src/compiler.h" | 9 #include "src/compiler.h" |
| 10 #include "src/frames-inl.h" | 10 #include "src/frames-inl.h" |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 163 RUNTIME_FUNCTION(Runtime_SetCode) { | 163 RUNTIME_FUNCTION(Runtime_SetCode) { |
| 164 HandleScope scope(isolate); | 164 HandleScope scope(isolate); |
| 165 DCHECK_EQ(2, args.length()); | 165 DCHECK_EQ(2, args.length()); |
| 166 | 166 |
| 167 CONVERT_ARG_HANDLE_CHECKED(JSFunction, target, 0); | 167 CONVERT_ARG_HANDLE_CHECKED(JSFunction, target, 0); |
| 168 CONVERT_ARG_HANDLE_CHECKED(JSFunction, source, 1); | 168 CONVERT_ARG_HANDLE_CHECKED(JSFunction, source, 1); |
| 169 | 169 |
| 170 Handle<SharedFunctionInfo> target_shared(target->shared()); | 170 Handle<SharedFunctionInfo> target_shared(target->shared()); |
| 171 Handle<SharedFunctionInfo> source_shared(source->shared()); | 171 Handle<SharedFunctionInfo> source_shared(source->shared()); |
| 172 | 172 |
| 173 if (FLAG_mark_shared_functions_for_tier_up) { | |
| 174 // During bootstrapping with stress-opt, it can happen that we've | |
| 175 // marked some builtin code for optimization. Defeat this, as | |
| 176 // that optimization attempt may fail on code without a script | |
| 177 // (all the %SetCode usages are like this). | |
| 178 source_shared->set_marked_for_tier_up(false); | |
| 179 } | |
|
Leszek Swirski
2017/02/09 13:22:33
Hm, I'm not sure I like your solution here -- for
| |
| 180 | |
| 173 if (!Compiler::Compile(source, Compiler::KEEP_EXCEPTION)) { | 181 if (!Compiler::Compile(source, Compiler::KEEP_EXCEPTION)) { |
| 174 return isolate->heap()->exception(); | 182 return isolate->heap()->exception(); |
| 175 } | 183 } |
| 176 | 184 |
| 177 // Mark both, the source and the target, as un-flushable because the | 185 // Mark both, the source and the target, as un-flushable because the |
| 178 // shared unoptimized code makes them impossible to enqueue in a list. | 186 // shared unoptimized code makes them impossible to enqueue in a list. |
| 179 DCHECK(target_shared->code()->gc_metadata() == NULL); | 187 DCHECK(target_shared->code()->gc_metadata() == NULL); |
| 180 DCHECK(source_shared->code()->gc_metadata() == NULL); | 188 DCHECK(source_shared->code()->gc_metadata() == NULL); |
| 181 target_shared->set_dont_flush(true); | 189 target_shared->set_dont_flush(true); |
| 182 source_shared->set_dont_flush(true); | 190 source_shared->set_dont_flush(true); |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 307 DCHECK_EQ(1, args.length()); | 315 DCHECK_EQ(1, args.length()); |
| 308 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, function, 0); | 316 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, function, 0); |
| 309 return function->IsJSBoundFunction() | 317 return function->IsJSBoundFunction() |
| 310 ? *JSBoundFunction::ToString( | 318 ? *JSBoundFunction::ToString( |
| 311 Handle<JSBoundFunction>::cast(function)) | 319 Handle<JSBoundFunction>::cast(function)) |
| 312 : *JSFunction::ToString(Handle<JSFunction>::cast(function)); | 320 : *JSFunction::ToString(Handle<JSFunction>::cast(function)); |
| 313 } | 321 } |
| 314 | 322 |
| 315 } // namespace internal | 323 } // namespace internal |
| 316 } // namespace v8 | 324 } // namespace v8 |
| OLD | NEW |