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/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/allocation-site-scopes.h" | 8 #include "src/allocation-site-scopes.h" |
9 #include "src/api.h" | 9 #include "src/api.h" |
10 #include "src/arguments.h" | 10 #include "src/arguments.h" |
11 #include "src/bootstrapper.h" | 11 #include "src/bootstrapper.h" |
12 #include "src/code-stubs.h" | 12 #include "src/code-stubs.h" |
13 #include "src/codegen.h" | 13 #include "src/codegen.h" |
14 #include "src/cpu-profiler.h" | 14 #include "src/cpu-profiler.h" |
15 #include "src/date.h" | 15 #include "src/date.h" |
16 #include "src/debug.h" | 16 #include "src/debug.h" |
17 #include "src/deoptimizer.h" | 17 #include "src/deoptimizer.h" |
18 #include "src/elements.h" | 18 #include "src/elements.h" |
19 #include "src/execution.h" | 19 #include "src/execution.h" |
20 #include "src/field-index-inl.h" | 20 #include "src/field-index-inl.h" |
21 #include "src/field-index.h" | 21 #include "src/field-index.h" |
22 #include "src/full-codegen.h" | 22 #include "src/full-codegen.h" |
23 #include "src/heap/mark-compact.h" | 23 #include "src/heap/mark-compact.h" |
24 #include "src/heap/objects-visiting-inl.h" | |
24 #include "src/hydrogen.h" | 25 #include "src/hydrogen.h" |
25 #include "src/isolate-inl.h" | 26 #include "src/isolate-inl.h" |
26 #include "src/log.h" | 27 #include "src/log.h" |
27 #include "src/lookup.h" | 28 #include "src/lookup.h" |
28 #include "src/macro-assembler.h" | 29 #include "src/macro-assembler.h" |
29 #include "src/objects-inl.h" | 30 #include "src/objects-inl.h" |
30 #include "src/objects-visiting-inl.h" | |
31 #include "src/prototype.h" | 31 #include "src/prototype.h" |
32 #include "src/safepoint-table.h" | 32 #include "src/safepoint-table.h" |
33 #include "src/string-search.h" | 33 #include "src/string-search.h" |
34 #include "src/string-stream.h" | 34 #include "src/string-stream.h" |
35 #include "src/utils.h" | 35 #include "src/utils.h" |
36 | 36 |
37 #ifdef ENABLE_DISASSEMBLER | 37 #ifdef ENABLE_DISASSEMBLER |
38 #include "src/disasm.h" | 38 #include "src/disasm.h" |
39 #include "src/disassembler.h" | 39 #include "src/disassembler.h" |
40 #endif | 40 #endif |
(...skipping 11510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
11551 PrintElementsTransition(stdout, object, elements_kind, old_elements, | 11551 PrintElementsTransition(stdout, object, elements_kind, old_elements, |
11552 object->GetElementsKind(), elems); | 11552 object->GetElementsKind(), elems); |
11553 } | 11553 } |
11554 | 11554 |
11555 if (object->IsJSArray()) { | 11555 if (object->IsJSArray()) { |
11556 Handle<JSArray>::cast(object)->set_length(Smi::FromInt(length)); | 11556 Handle<JSArray>::cast(object)->set_length(Smi::FromInt(length)); |
11557 } | 11557 } |
11558 } | 11558 } |
11559 | 11559 |
11560 | 11560 |
11561 void Code::CodeIterateBody(ObjectVisitor* v) { | |
Michael Starzinger
2014/08/06 11:35:29
Would it be possible to move this into the objects
Hannes Payer (out of office)
2014/08/07 11:12:03
Unfortunately, this is not easy.
| |
11562 int mode_mask = RelocInfo::kCodeTargetMask | | |
11563 RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT) | | |
11564 RelocInfo::ModeMask(RelocInfo::CELL) | | |
11565 RelocInfo::ModeMask(RelocInfo::EXTERNAL_REFERENCE) | | |
11566 RelocInfo::ModeMask(RelocInfo::JS_RETURN) | | |
11567 RelocInfo::ModeMask(RelocInfo::DEBUG_BREAK_SLOT) | | |
11568 RelocInfo::ModeMask(RelocInfo::RUNTIME_ENTRY); | |
11569 | |
11570 // There are two places where we iterate code bodies: here and the | |
11571 // templated CodeIterateBody (below). They should be kept in sync. | |
11572 IteratePointer(v, kRelocationInfoOffset); | |
11573 IteratePointer(v, kHandlerTableOffset); | |
11574 IteratePointer(v, kDeoptimizationDataOffset); | |
11575 IteratePointer(v, kTypeFeedbackInfoOffset); | |
11576 IterateNextCodeLink(v, kNextCodeLinkOffset); | |
11577 IteratePointer(v, kConstantPoolOffset); | |
11578 | |
11579 RelocIterator it(this, mode_mask); | |
11580 Isolate* isolate = this->GetIsolate(); | |
11581 for (; !it.done(); it.next()) { | |
11582 it.rinfo()->Visit(isolate, v); | |
11583 } | |
11584 } | |
11585 | |
11586 | |
11561 // static | 11587 // static |
11562 void JSArray::Initialize(Handle<JSArray> array, int capacity, int length) { | 11588 void JSArray::Initialize(Handle<JSArray> array, int capacity, int length) { |
11563 DCHECK(capacity >= 0); | 11589 DCHECK(capacity >= 0); |
11564 array->GetIsolate()->factory()->NewJSArrayStorage( | 11590 array->GetIsolate()->factory()->NewJSArrayStorage( |
11565 array, length, capacity, INITIALIZE_ARRAY_ELEMENTS_WITH_HOLE); | 11591 array, length, capacity, INITIALIZE_ARRAY_ELEMENTS_WITH_HOLE); |
11566 } | 11592 } |
11567 | 11593 |
11568 | 11594 |
11569 void JSArray::Expand(Handle<JSArray> array, int required_size) { | 11595 void JSArray::Expand(Handle<JSArray> array, int required_size) { |
11570 ElementsAccessor* accessor = array->GetElementsAccessor(); | 11596 ElementsAccessor* accessor = array->GetElementsAccessor(); |
(...skipping 5319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
16890 #define ERROR_MESSAGES_TEXTS(C, T) T, | 16916 #define ERROR_MESSAGES_TEXTS(C, T) T, |
16891 static const char* error_messages_[] = { | 16917 static const char* error_messages_[] = { |
16892 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) | 16918 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) |
16893 }; | 16919 }; |
16894 #undef ERROR_MESSAGES_TEXTS | 16920 #undef ERROR_MESSAGES_TEXTS |
16895 return error_messages_[reason]; | 16921 return error_messages_[reason]; |
16896 } | 16922 } |
16897 | 16923 |
16898 | 16924 |
16899 } } // namespace v8::internal | 16925 } } // namespace v8::internal |
OLD | NEW |