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

Side by Side Diff: src/objects.cc

Issue 426233002: Land the Fan (disabled) (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Review feedback, rebase and "git cl format" Created 6 years, 4 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 | Annotate | Revision Log
« 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 "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"
(...skipping 1493 matching lines...) Expand 10 before | Expand all | Expand 10 after
1504 } 1504 }
1505 case JS_MESSAGE_OBJECT_TYPE: 1505 case JS_MESSAGE_OBJECT_TYPE:
1506 os << "<JSMessageObject>"; 1506 os << "<JSMessageObject>";
1507 break; 1507 break;
1508 #define MAKE_STRUCT_CASE(NAME, Name, name) \ 1508 #define MAKE_STRUCT_CASE(NAME, Name, name) \
1509 case NAME##_TYPE: \ 1509 case NAME##_TYPE: \
1510 os << "<" #Name ">"; \ 1510 os << "<" #Name ">"; \
1511 break; 1511 break;
1512 STRUCT_LIST(MAKE_STRUCT_CASE) 1512 STRUCT_LIST(MAKE_STRUCT_CASE)
1513 #undef MAKE_STRUCT_CASE 1513 #undef MAKE_STRUCT_CASE
1514 case CODE_TYPE: 1514 case CODE_TYPE: {
1515 os << "<Code>"; 1515 Code* code = Code::cast(this);
1516 os << "<Code: " << Code::Kind2String(code->kind()) << ">";
1516 break; 1517 break;
1518 }
1517 case ODDBALL_TYPE: { 1519 case ODDBALL_TYPE: {
1518 if (IsUndefined()) { 1520 if (IsUndefined()) {
1519 os << "<undefined>"; 1521 os << "<undefined>";
1520 } else if (IsTheHole()) { 1522 } else if (IsTheHole()) {
1521 os << "<the hole>"; 1523 os << "<the hole>";
1522 } else if (IsNull()) { 1524 } else if (IsNull()) {
1523 os << "<null>"; 1525 os << "<null>";
1524 } else if (IsTrue()) { 1526 } else if (IsTrue()) {
1525 os << "<true>"; 1527 os << "<true>";
1526 } else if (IsFalse()) { 1528 } else if (IsFalse()) {
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
1728 return DoubleToBoolean(value()); 1730 return DoubleToBoolean(value());
1729 } 1731 }
1730 1732
1731 1733
1732 void HeapNumber::HeapNumberPrint(OStream& os) { // NOLINT 1734 void HeapNumber::HeapNumberPrint(OStream& os) { // NOLINT
1733 os << value(); 1735 os << value();
1734 } 1736 }
1735 1737
1736 1738
1737 String* JSReceiver::class_name() { 1739 String* JSReceiver::class_name() {
1738 if (IsJSFunction() && IsJSFunctionProxy()) { 1740 if (IsJSFunction() || IsJSFunctionProxy()) {
1739 return GetHeap()->function_class_string(); 1741 return GetHeap()->function_class_string();
1740 } 1742 }
1741 if (map()->constructor()->IsJSFunction()) { 1743 if (map()->constructor()->IsJSFunction()) {
1742 JSFunction* constructor = JSFunction::cast(map()->constructor()); 1744 JSFunction* constructor = JSFunction::cast(map()->constructor());
1743 return String::cast(constructor->shared()->instance_class_name()); 1745 return String::cast(constructor->shared()->instance_class_name());
1744 } 1746 }
1745 // If the constructor is not present, return "Object". 1747 // If the constructor is not present, return "Object".
1746 return GetHeap()->Object_string(); 1748 return GetHeap()->Object_string();
1747 } 1749 }
1748 1750
(...skipping 6662 matching lines...) Expand 10 before | Expand all | Expand 10 after
8411 } 8413 }
8412 8414
8413 8415
8414 Object* AccessorPair::GetComponent(AccessorComponent component) { 8416 Object* AccessorPair::GetComponent(AccessorComponent component) {
8415 Object* accessor = get(component); 8417 Object* accessor = get(component);
8416 return accessor->IsTheHole() ? GetHeap()->undefined_value() : accessor; 8418 return accessor->IsTheHole() ? GetHeap()->undefined_value() : accessor;
8417 } 8419 }
8418 8420
8419 8421
8420 Handle<DeoptimizationInputData> DeoptimizationInputData::New( 8422 Handle<DeoptimizationInputData> DeoptimizationInputData::New(
8421 Isolate* isolate, 8423 Isolate* isolate, int deopt_entry_count, int return_patch_address_count,
8422 int deopt_entry_count,
8423 PretenureFlag pretenure) { 8424 PretenureFlag pretenure) {
8424 ASSERT(deopt_entry_count > 0); 8425 ASSERT(deopt_entry_count + return_patch_address_count > 0);
8425 return Handle<DeoptimizationInputData>::cast( 8426 Handle<FixedArray> deoptimization_data =
8426 isolate->factory()->NewFixedArray( 8427 Handle<FixedArray>::cast(isolate->factory()->NewFixedArray(
8427 LengthFor(deopt_entry_count), pretenure)); 8428 LengthFor(deopt_entry_count, return_patch_address_count), pretenure));
8429 deoptimization_data->set(kDeoptEntryCountIndex,
8430 Smi::FromInt(deopt_entry_count));
8431 deoptimization_data->set(kReturnAddressPatchEntryCountIndex,
8432 Smi::FromInt(return_patch_address_count));
8433 return Handle<DeoptimizationInputData>::cast(deoptimization_data);
8428 } 8434 }
8429 8435
8430 8436
8431 Handle<DeoptimizationOutputData> DeoptimizationOutputData::New( 8437 Handle<DeoptimizationOutputData> DeoptimizationOutputData::New(
8432 Isolate* isolate, 8438 Isolate* isolate,
8433 int number_of_deopt_points, 8439 int number_of_deopt_points,
8434 PretenureFlag pretenure) { 8440 PretenureFlag pretenure) {
8435 Handle<FixedArray> result; 8441 Handle<FixedArray> result;
8436 if (number_of_deopt_points == 0) { 8442 if (number_of_deopt_points == 0) {
8437 result = isolate->factory()->empty_fixed_array(); 8443 result = isolate->factory()->empty_fixed_array();
(...skipping 1717 matching lines...) Expand 10 before | Expand all | Expand 10 after
10155 } 10161 }
10156 10162
10157 10163
10158 // The filter is a pattern that matches function names in this way: 10164 // The filter is a pattern that matches function names in this way:
10159 // "*" all; the default 10165 // "*" all; the default
10160 // "-" all but the top-level function 10166 // "-" all but the top-level function
10161 // "-name" all but the function "name" 10167 // "-name" all but the function "name"
10162 // "" only the top-level function 10168 // "" only the top-level function
10163 // "name" only the function "name" 10169 // "name" only the function "name"
10164 // "name*" only functions starting with "name" 10170 // "name*" only functions starting with "name"
10171 // "~" none; the tilde is not an identifier
10165 bool JSFunction::PassesFilter(const char* raw_filter) { 10172 bool JSFunction::PassesFilter(const char* raw_filter) {
10166 if (*raw_filter == '*') return true; 10173 if (*raw_filter == '*') return true;
10167 String* name = shared()->DebugName(); 10174 String* name = shared()->DebugName();
10168 Vector<const char> filter = CStrVector(raw_filter); 10175 Vector<const char> filter = CStrVector(raw_filter);
10169 if (filter.length() == 0) return name->length() == 0; 10176 if (filter.length() == 0) return name->length() == 0;
10170 if (filter[0] == '-') { 10177 if (filter[0] == '-') {
10171 // Negative filter. 10178 // Negative filter.
10172 if (filter.length() == 1) { 10179 if (filter.length() == 1) {
10173 return (name->length() != 0); 10180 return (name->length() != 0);
10174 } else if (name->IsUtf8EqualTo(filter.SubVector(1, filter.length()))) { 10181 } else if (name->IsUtf8EqualTo(filter.SubVector(1, filter.length()))) {
(...skipping 1059 matching lines...) Expand 10 before | Expand all | Expand 10 after
11234 } 11241 }
11235 11242
11236 11243
11237 #ifdef ENABLE_DISASSEMBLER 11244 #ifdef ENABLE_DISASSEMBLER
11238 11245
11239 void DeoptimizationInputData::DeoptimizationInputDataPrint( 11246 void DeoptimizationInputData::DeoptimizationInputDataPrint(
11240 OStream& os) { // NOLINT 11247 OStream& os) { // NOLINT
11241 disasm::NameConverter converter; 11248 disasm::NameConverter converter;
11242 int deopt_count = DeoptCount(); 11249 int deopt_count = DeoptCount();
11243 os << "Deoptimization Input Data (deopt points = " << deopt_count << ")\n"; 11250 os << "Deoptimization Input Data (deopt points = " << deopt_count << ")\n";
11244 if (0 == deopt_count) return; 11251 if (0 != deopt_count) {
11245 11252 os << " index ast id argc pc";
11246 os << " index ast id argc pc"; 11253 if (FLAG_print_code_verbose) os << "commands";
11247 if (FLAG_print_code_verbose) os << "commands"; 11254 os << "\n";
11248 os << "\n"; 11255 }
11249 for (int i = 0; i < deopt_count; i++) { 11256 for (int i = 0; i < deopt_count; i++) {
11250 // TODO(svenpanne) Add some basic formatting to our streams. 11257 // TODO(svenpanne) Add some basic formatting to our streams.
11251 Vector<char> buf1 = Vector<char>::New(128); 11258 Vector<char> buf1 = Vector<char>::New(128);
11252 SNPrintF(buf1, "%6d %6d %6d %6d", i, AstId(i).ToInt(), 11259 SNPrintF(buf1, "%6d %6d %6d %6d", i, AstId(i).ToInt(),
11253 ArgumentsStackHeight(i)->value(), Pc(i)->value()); 11260 ArgumentsStackHeight(i)->value(), Pc(i)->value());
11254 os << buf1.start(); 11261 os << buf1.start();
11255 11262
11256 if (!FLAG_print_code_verbose) { 11263 if (!FLAG_print_code_verbose) {
11257 os << "\n"; 11264 os << "\n";
11258 continue; 11265 continue;
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
11387 case Translation::ARGUMENTS_OBJECT: 11394 case Translation::ARGUMENTS_OBJECT:
11388 case Translation::CAPTURED_OBJECT: { 11395 case Translation::CAPTURED_OBJECT: {
11389 int args_length = iterator.Next(); 11396 int args_length = iterator.Next();
11390 os << "{length=" << args_length << "}"; 11397 os << "{length=" << args_length << "}";
11391 break; 11398 break;
11392 } 11399 }
11393 } 11400 }
11394 os << "\n"; 11401 os << "\n";
11395 } 11402 }
11396 } 11403 }
11404
11405 int return_address_patch_count = ReturnAddressPatchCount();
11406 if (return_address_patch_count != 0) {
11407 os << "Return address patch data (count = " << return_address_patch_count
11408 << ")\n";
11409 os << "index pc patched_pc\n";
11410 }
11411 for (int i = 0; i < return_address_patch_count; i++) {
11412 Vector<char> buf = Vector<char>::New(128);
11413 SNPrintF(buf, "%6d %6d %10d", i, ReturnAddressPc(i)->value(),
11414 PatchedAddressPc(i)->value());
11415 os << buf.start();
11416 }
11397 } 11417 }
11398 11418
11399 11419
11400 void DeoptimizationOutputData::DeoptimizationOutputDataPrint( 11420 void DeoptimizationOutputData::DeoptimizationOutputDataPrint(
11401 OStream& os) { // NOLINT 11421 OStream& os) { // NOLINT
11402 os << "Deoptimization Output Data (deopt points = " << this->DeoptPoints() 11422 os << "Deoptimization Output Data (deopt points = " << this->DeoptPoints()
11403 << ")\n"; 11423 << ")\n";
11404 if (this->DeoptPoints() == 0) return; 11424 if (this->DeoptPoints() == 0) return;
11405 11425
11406 os << "ast id pc state\n"; 11426 os << "ast id pc state\n";
(...skipping 5589 matching lines...) Expand 10 before | Expand all | Expand 10 after
16996 #define ERROR_MESSAGES_TEXTS(C, T) T, 17016 #define ERROR_MESSAGES_TEXTS(C, T) T,
16997 static const char* error_messages_[] = { 17017 static const char* error_messages_[] = {
16998 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) 17018 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS)
16999 }; 17019 };
17000 #undef ERROR_MESSAGES_TEXTS 17020 #undef ERROR_MESSAGES_TEXTS
17001 return error_messages_[reason]; 17021 return error_messages_[reason];
17002 } 17022 }
17003 17023
17004 17024
17005 } } // namespace v8::internal 17025 } } // namespace v8::internal
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