Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(299)

Side by Side Diff: src/objects.cc

Issue 1230753004: [Interpreter] Add BytecodeArray class and add to SharedFunctionInfo. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix pedantic build (take2). Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/objects.h ('k') | src/objects-debug.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <iomanip> 5 #include <iomanip>
6 #include <sstream> 6 #include <sstream>
7 7
8 #include "src/v8.h" 8 #include "src/v8.h"
9 9
10 #include "src/accessors.h" 10 #include "src/accessors.h"
(...skipping 13 matching lines...) Expand all
24 #include "src/deoptimizer.h" 24 #include "src/deoptimizer.h"
25 #include "src/elements.h" 25 #include "src/elements.h"
26 #include "src/execution.h" 26 #include "src/execution.h"
27 #include "src/field-index-inl.h" 27 #include "src/field-index-inl.h"
28 #include "src/field-index.h" 28 #include "src/field-index.h"
29 #include "src/full-codegen.h" 29 #include "src/full-codegen.h"
30 #include "src/heap/mark-compact.h" 30 #include "src/heap/mark-compact.h"
31 #include "src/heap/objects-visiting-inl.h" 31 #include "src/heap/objects-visiting-inl.h"
32 #include "src/hydrogen.h" 32 #include "src/hydrogen.h"
33 #include "src/ic/ic.h" 33 #include "src/ic/ic.h"
34 #include "src/interpreter/bytecodes.h"
34 #include "src/log.h" 35 #include "src/log.h"
35 #include "src/lookup.h" 36 #include "src/lookup.h"
36 #include "src/macro-assembler.h" 37 #include "src/macro-assembler.h"
37 #include "src/messages.h" 38 #include "src/messages.h"
38 #include "src/objects-inl.h" 39 #include "src/objects-inl.h"
39 #include "src/prototype.h" 40 #include "src/prototype.h"
40 #include "src/safepoint-table.h" 41 #include "src/safepoint-table.h"
41 #include "src/string-search.h" 42 #include "src/string-search.h"
42 #include "src/string-stream.h" 43 #include "src/string-stream.h"
43 #include "src/utils.h" 44 #include "src/utils.h"
(...skipping 1222 matching lines...) Expand 10 before | Expand all | Expand 10 after
1266 case FIXED_ARRAY_TYPE: 1267 case FIXED_ARRAY_TYPE:
1267 os << "<FixedArray[" << FixedArray::cast(this)->length() << "]>"; 1268 os << "<FixedArray[" << FixedArray::cast(this)->length() << "]>";
1268 break; 1269 break;
1269 case FIXED_DOUBLE_ARRAY_TYPE: 1270 case FIXED_DOUBLE_ARRAY_TYPE:
1270 os << "<FixedDoubleArray[" << FixedDoubleArray::cast(this)->length() 1271 os << "<FixedDoubleArray[" << FixedDoubleArray::cast(this)->length()
1271 << "]>"; 1272 << "]>";
1272 break; 1273 break;
1273 case BYTE_ARRAY_TYPE: 1274 case BYTE_ARRAY_TYPE:
1274 os << "<ByteArray[" << ByteArray::cast(this)->length() << "]>"; 1275 os << "<ByteArray[" << ByteArray::cast(this)->length() << "]>";
1275 break; 1276 break;
1277 case BYTECODE_ARRAY_TYPE:
1278 os << "<BytecodeArray[" << BytecodeArray::cast(this)->length() << "]>";
1279 break;
1276 case FREE_SPACE_TYPE: 1280 case FREE_SPACE_TYPE:
1277 os << "<FreeSpace[" << FreeSpace::cast(this)->Size() << "]>"; 1281 os << "<FreeSpace[" << FreeSpace::cast(this)->Size() << "]>";
1278 break; 1282 break;
1279 #define TYPED_ARRAY_SHORT_PRINT(Type, type, TYPE, ctype, size) \ 1283 #define TYPED_ARRAY_SHORT_PRINT(Type, type, TYPE, ctype, size) \
1280 case EXTERNAL_##TYPE##_ARRAY_TYPE: \ 1284 case EXTERNAL_##TYPE##_ARRAY_TYPE: \
1281 os << "<External" #Type "Array[" \ 1285 os << "<External" #Type "Array[" \
1282 << External##Type##Array::cast(this)->length() << "]>"; \ 1286 << External##Type##Array::cast(this)->length() << "]>"; \
1283 break; \ 1287 break; \
1284 case FIXED_##TYPE##_ARRAY_TYPE: \ 1288 case FIXED_##TYPE##_ARRAY_TYPE: \
1285 os << "<Fixed" #Type "Array[" << Fixed##Type##Array::cast(this)->length() \ 1289 os << "<Fixed" #Type "Array[" << Fixed##Type##Array::cast(this)->length() \
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
1492 break; 1496 break;
1493 case SYMBOL_TYPE: 1497 case SYMBOL_TYPE:
1494 Symbol::BodyDescriptor::IterateBody(this, v); 1498 Symbol::BodyDescriptor::IterateBody(this, v);
1495 break; 1499 break;
1496 1500
1497 case HEAP_NUMBER_TYPE: 1501 case HEAP_NUMBER_TYPE:
1498 case MUTABLE_HEAP_NUMBER_TYPE: 1502 case MUTABLE_HEAP_NUMBER_TYPE:
1499 case FLOAT32X4_TYPE: 1503 case FLOAT32X4_TYPE:
1500 case FILLER_TYPE: 1504 case FILLER_TYPE:
1501 case BYTE_ARRAY_TYPE: 1505 case BYTE_ARRAY_TYPE:
1506 case BYTECODE_ARRAY_TYPE:
1502 case FREE_SPACE_TYPE: 1507 case FREE_SPACE_TYPE:
1503 break; 1508 break;
1504 1509
1505 #define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \ 1510 #define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \
1506 case EXTERNAL_##TYPE##_ARRAY_TYPE: \ 1511 case EXTERNAL_##TYPE##_ARRAY_TYPE: \
1507 break; \ 1512 break; \
1508 \ 1513 \
1509 case FIXED_##TYPE##_ARRAY_TYPE: \ 1514 case FIXED_##TYPE##_ARRAY_TYPE: \
1510 reinterpret_cast<FixedTypedArrayBase*>(this) \ 1515 reinterpret_cast<FixedTypedArrayBase*>(this) \
1511 ->FixedTypedArrayBaseIterateBody(v); \ 1516 ->FixedTypedArrayBaseIterateBody(v); \
(...skipping 10093 matching lines...) Expand 10 before | Expand all | Expand 10 after
11605 11610
11606 os << "RelocInfo (size = " << relocation_size() << ")\n"; 11611 os << "RelocInfo (size = " << relocation_size() << ")\n";
11607 for (RelocIterator it(this); !it.done(); it.next()) { 11612 for (RelocIterator it(this); !it.done(); it.next()) {
11608 it.rinfo()->Print(GetIsolate(), os); 11613 it.rinfo()->Print(GetIsolate(), os);
11609 } 11614 }
11610 os << "\n"; 11615 os << "\n";
11611 } 11616 }
11612 #endif // ENABLE_DISASSEMBLER 11617 #endif // ENABLE_DISASSEMBLER
11613 11618
11614 11619
11620 void BytecodeArray::Disassemble(std::ostream& os) {
11621 os << "Frame size " << frame_size()
11622 << ", number of locals = " << number_of_locals() << "\n";
11623 Vector<char> buf = Vector<char>::New(50);
11624 int bytecode_size = 0;
11625 for (int i = 0; i < this->length(); i += bytecode_size) {
11626 interpreter::Bytecode bytecode = static_cast<interpreter::Bytecode>(get(i));
11627 bytecode_size = interpreter::Bytecodes::Size(bytecode);
11628
11629 SNPrintF(buf, "%p : ", GetFirstBytecodeAddress() + i);
11630 os << buf.start();
11631 for (int j = 0; j < bytecode_size; j++) {
11632 SNPrintF(buf, "%02x ", get(i + j));
11633 os << buf.start();
11634 }
11635 for (int j = bytecode_size; j < interpreter::Bytecodes::kMaximumSize; j++) {
11636 os << " ";
11637 }
11638 os << bytecode;
11639 }
11640 }
11641
11642
11615 // static 11643 // static
11616 void JSArray::Initialize(Handle<JSArray> array, int capacity, int length) { 11644 void JSArray::Initialize(Handle<JSArray> array, int capacity, int length) {
11617 DCHECK(capacity >= 0); 11645 DCHECK(capacity >= 0);
11618 array->GetIsolate()->factory()->NewJSArrayStorage( 11646 array->GetIsolate()->factory()->NewJSArrayStorage(
11619 array, length, capacity, INITIALIZE_ARRAY_ELEMENTS_WITH_HOLE); 11647 array, length, capacity, INITIALIZE_ARRAY_ELEMENTS_WITH_HOLE);
11620 } 11648 }
11621 11649
11622 11650
11623 // Returns false if the passed-in index is marked non-configurable, which will 11651 // Returns false if the passed-in index is marked non-configurable, which will
11624 // cause the truncation operation to halt, and thus no further old values need 11652 // cause the truncation operation to halt, and thus no further old values need
(...skipping 4271 matching lines...) Expand 10 before | Expand all | Expand 10 after
15896 Handle<Object> new_value) { 15924 Handle<Object> new_value) {
15897 if (cell->value() != *new_value) { 15925 if (cell->value() != *new_value) {
15898 cell->set_value(*new_value); 15926 cell->set_value(*new_value);
15899 Isolate* isolate = cell->GetIsolate(); 15927 Isolate* isolate = cell->GetIsolate();
15900 cell->dependent_code()->DeoptimizeDependentCodeGroup( 15928 cell->dependent_code()->DeoptimizeDependentCodeGroup(
15901 isolate, DependentCode::kPropertyCellChangedGroup); 15929 isolate, DependentCode::kPropertyCellChangedGroup);
15902 } 15930 }
15903 } 15931 }
15904 } // namespace internal 15932 } // namespace internal
15905 } // namespace v8 15933 } // namespace v8
OLDNEW
« no previous file with comments | « src/objects.h ('k') | src/objects-debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698