OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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 |
11 #include "src/objects-inl.h" | 11 #include "src/objects-inl.h" |
12 | 12 |
13 #include "src/accessors.h" | 13 #include "src/accessors.h" |
14 #include "src/allocation-site-scopes.h" | 14 #include "src/allocation-site-scopes.h" |
15 #include "src/api.h" | |
16 #include "src/api-arguments.h" | 15 #include "src/api-arguments.h" |
17 #include "src/api-natives.h" | 16 #include "src/api-natives.h" |
| 17 #include "src/api.h" |
18 #include "src/base/bits.h" | 18 #include "src/base/bits.h" |
19 #include "src/base/utils/random-number-generator.h" | 19 #include "src/base/utils/random-number-generator.h" |
20 #include "src/bootstrapper.h" | 20 #include "src/bootstrapper.h" |
21 #include "src/code-stubs.h" | 21 #include "src/code-stubs.h" |
22 #include "src/codegen.h" | 22 #include "src/codegen.h" |
23 #include "src/compilation-dependencies.h" | 23 #include "src/compilation-dependencies.h" |
24 #include "src/compiler.h" | 24 #include "src/compiler.h" |
25 #include "src/date.h" | 25 #include "src/date.h" |
26 #include "src/debug/debug.h" | 26 #include "src/debug/debug.h" |
27 #include "src/deoptimizer.h" | 27 #include "src/deoptimizer.h" |
28 #include "src/elements.h" | 28 #include "src/elements.h" |
29 #include "src/execution.h" | 29 #include "src/execution.h" |
30 #include "src/field-index-inl.h" | 30 #include "src/field-index-inl.h" |
31 #include "src/field-index.h" | 31 #include "src/field-index.h" |
32 #include "src/field-type.h" | 32 #include "src/field-type.h" |
| 33 #include "src/frames-inl.h" |
33 #include "src/full-codegen/full-codegen.h" | 34 #include "src/full-codegen/full-codegen.h" |
34 #include "src/ic/ic.h" | 35 #include "src/ic/ic.h" |
35 #include "src/identity-map.h" | 36 #include "src/identity-map.h" |
36 #include "src/interpreter/bytecode-array-iterator.h" | 37 #include "src/interpreter/bytecode-array-iterator.h" |
37 #include "src/interpreter/interpreter.h" | 38 #include "src/interpreter/interpreter.h" |
38 #include "src/interpreter/source-position-table.h" | 39 #include "src/interpreter/source-position-table.h" |
39 #include "src/isolate-inl.h" | 40 #include "src/isolate-inl.h" |
40 #include "src/keys.h" | 41 #include "src/keys.h" |
41 #include "src/list.h" | 42 #include "src/list.h" |
42 #include "src/log.h" | 43 #include "src/log.h" |
(...skipping 12950 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12993 isolate->factory()->InternalizeUtf8String(to_string); | 12994 isolate->factory()->InternalizeUtf8String(to_string); |
12994 Handle<String> internalized_type_of = | 12995 Handle<String> internalized_type_of = |
12995 isolate->factory()->InternalizeUtf8String(type_of); | 12996 isolate->factory()->InternalizeUtf8String(type_of); |
12996 oddball->set_to_boolean(isolate->heap()->ToBoolean(to_boolean)); | 12997 oddball->set_to_boolean(isolate->heap()->ToBoolean(to_boolean)); |
12997 oddball->set_to_number(*to_number); | 12998 oddball->set_to_number(*to_number); |
12998 oddball->set_to_string(*internalized_to_string); | 12999 oddball->set_to_string(*internalized_to_string); |
12999 oddball->set_type_of(*internalized_type_of); | 13000 oddball->set_type_of(*internalized_type_of); |
13000 oddball->set_kind(kind); | 13001 oddball->set_kind(kind); |
13001 } | 13002 } |
13002 | 13003 |
| 13004 void Script::SetEvalOrigin(Handle<Script> script, |
| 13005 Handle<SharedFunctionInfo> outer_info, |
| 13006 int eval_position) { |
| 13007 if (eval_position == RelocInfo::kNoPosition) { |
| 13008 // If the position is missing, attempt to get the code offset from the |
| 13009 // current activation. Do not translate the code offset into source |
| 13010 // position, but store it as negative value for lazy translation. |
| 13011 StackTraceFrameIterator it(script->GetIsolate()); |
| 13012 if (!it.done() && it.is_javascript()) { |
| 13013 FrameSummary summary = FrameSummary::GetFirst(it.javascript_frame()); |
| 13014 script->set_eval_from_shared(summary.function()->shared()); |
| 13015 script->set_eval_from_position(-summary.code_offset()); |
| 13016 return; |
| 13017 } |
| 13018 eval_position = 0; |
| 13019 } |
| 13020 script->set_eval_from_shared(*outer_info); |
| 13021 script->set_eval_from_position(eval_position); |
| 13022 } |
| 13023 |
| 13024 int Script::GetEvalPosition() { |
| 13025 DisallowHeapAllocation no_gc; |
| 13026 DCHECK(compilation_type() == Script::COMPILATION_TYPE_EVAL); |
| 13027 int position = eval_from_position(); |
| 13028 if (position < 0) { |
| 13029 // Due to laziness, the position may not have been translated from code |
| 13030 // offset yet, which would be encoded as negative integer. In that case, |
| 13031 // translate and set the position. |
| 13032 if (eval_from_shared()->IsUndefined()) { |
| 13033 position = 0; |
| 13034 } else { |
| 13035 SharedFunctionInfo* shared = SharedFunctionInfo::cast(eval_from_shared()); |
| 13036 position = shared->abstract_code()->SourcePosition(-position); |
| 13037 } |
| 13038 DCHECK(position >= 0); |
| 13039 set_eval_from_position(position); |
| 13040 } |
| 13041 return position; |
| 13042 } |
13003 | 13043 |
13004 void Script::InitLineEnds(Handle<Script> script) { | 13044 void Script::InitLineEnds(Handle<Script> script) { |
13005 if (!script->line_ends()->IsUndefined()) return; | 13045 if (!script->line_ends()->IsUndefined()) return; |
13006 | 13046 |
13007 Isolate* isolate = script->GetIsolate(); | 13047 Isolate* isolate = script->GetIsolate(); |
13008 | 13048 |
13009 if (!script->source()->IsString()) { | 13049 if (!script->source()->IsString()) { |
13010 DCHECK(script->source()->IsUndefined()); | 13050 DCHECK(script->source()->IsUndefined()); |
13011 Handle<FixedArray> empty = isolate->factory()->NewFixedArray(0); | 13051 Handle<FixedArray> empty = isolate->factory()->NewFixedArray(0); |
13012 script->set_line_ends(*empty); | 13052 script->set_line_ends(*empty); |
(...skipping 6393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
19406 if (cell->value() != *new_value) { | 19446 if (cell->value() != *new_value) { |
19407 cell->set_value(*new_value); | 19447 cell->set_value(*new_value); |
19408 Isolate* isolate = cell->GetIsolate(); | 19448 Isolate* isolate = cell->GetIsolate(); |
19409 cell->dependent_code()->DeoptimizeDependentCodeGroup( | 19449 cell->dependent_code()->DeoptimizeDependentCodeGroup( |
19410 isolate, DependentCode::kPropertyCellChangedGroup); | 19450 isolate, DependentCode::kPropertyCellChangedGroup); |
19411 } | 19451 } |
19412 } | 19452 } |
19413 | 19453 |
19414 } // namespace internal | 19454 } // namespace internal |
19415 } // namespace v8 | 19455 } // namespace v8 |
OLD | NEW |