| 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/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 |
| (...skipping 1534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1545 | 1545 |
| 1546 void String::PrintUC16(std::ostream& os, int start, int end) { // NOLINT | 1546 void String::PrintUC16(std::ostream& os, int start, int end) { // NOLINT |
| 1547 if (end < 0) end = length(); | 1547 if (end < 0) end = length(); |
| 1548 StringCharacterStream stream(this, start); | 1548 StringCharacterStream stream(this, start); |
| 1549 for (int i = start; i < end && stream.HasMore(); i++) { | 1549 for (int i = start; i < end && stream.HasMore(); i++) { |
| 1550 os << AsUC16(stream.GetNext()); | 1550 os << AsUC16(stream.GetNext()); |
| 1551 } | 1551 } |
| 1552 } | 1552 } |
| 1553 | 1553 |
| 1554 | 1554 |
| 1555 // The filter is a pattern that matches string names in this way: | |
| 1556 // "*" all; the default | |
| 1557 // "-name" all but "name" | |
| 1558 // "name" only the function "name" | |
| 1559 // "name*" only functions starting with "name" | |
| 1560 // "~" none; the tilde is not an identifier | |
| 1561 bool String::PassesFilter(const char* raw_filter) { | |
| 1562 if (*raw_filter == '*') return true; | |
| 1563 | |
| 1564 Vector<const char> filter = CStrVector(raw_filter); | |
| 1565 if (filter.length() == 0) return length() == 0; | |
| 1566 if (filter[0] == '-') { | |
| 1567 // Negative filter. | |
| 1568 if (filter.length() == 1) { | |
| 1569 return (length() != 0); | |
| 1570 } else if (IsUtf8EqualTo(filter.SubVector(1, filter.length()))) { | |
| 1571 return false; | |
| 1572 } | |
| 1573 if (filter[filter.length() - 1] == '*' && | |
| 1574 IsUtf8EqualTo(filter.SubVector(1, filter.length() - 1), true)) { | |
| 1575 return false; | |
| 1576 } | |
| 1577 return true; | |
| 1578 | |
| 1579 } else if (IsUtf8EqualTo(filter)) { | |
| 1580 return true; | |
| 1581 } | |
| 1582 if (filter[filter.length() - 1] == '*' && | |
| 1583 IsUtf8EqualTo(filter.SubVector(0, filter.length() - 1), true)) { | |
| 1584 return true; | |
| 1585 } | |
| 1586 return false; | |
| 1587 } | |
| 1588 | |
| 1589 | |
| 1590 void JSObject::JSObjectShortPrint(StringStream* accumulator) { | 1555 void JSObject::JSObjectShortPrint(StringStream* accumulator) { |
| 1591 switch (map()->instance_type()) { | 1556 switch (map()->instance_type()) { |
| 1592 case JS_ARRAY_TYPE: { | 1557 case JS_ARRAY_TYPE: { |
| 1593 double length = JSArray::cast(this)->length()->IsUndefined() | 1558 double length = JSArray::cast(this)->length()->IsUndefined() |
| 1594 ? 0 | 1559 ? 0 |
| 1595 : JSArray::cast(this)->length()->Number(); | 1560 : JSArray::cast(this)->length()->Number(); |
| 1596 accumulator->Add("<JS Array[%u]>", static_cast<uint32_t>(length)); | 1561 accumulator->Add("<JS Array[%u]>", static_cast<uint32_t>(length)); |
| 1597 break; | 1562 break; |
| 1598 } | 1563 } |
| 1599 case JS_WEAK_MAP_TYPE: { | 1564 case JS_WEAK_MAP_TYPE: { |
| (...skipping 9400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11000 | 10965 |
| 11001 // The filter is a pattern that matches function names in this way: | 10966 // The filter is a pattern that matches function names in this way: |
| 11002 // "*" all; the default | 10967 // "*" all; the default |
| 11003 // "-" all but the top-level function | 10968 // "-" all but the top-level function |
| 11004 // "-name" all but the function "name" | 10969 // "-name" all but the function "name" |
| 11005 // "" only the top-level function | 10970 // "" only the top-level function |
| 11006 // "name" only the function "name" | 10971 // "name" only the function "name" |
| 11007 // "name*" only functions starting with "name" | 10972 // "name*" only functions starting with "name" |
| 11008 // "~" none; the tilde is not an identifier | 10973 // "~" none; the tilde is not an identifier |
| 11009 bool JSFunction::PassesFilter(const char* raw_filter) { | 10974 bool JSFunction::PassesFilter(const char* raw_filter) { |
| 10975 if (*raw_filter == '*') return true; |
| 11010 String* name = shared()->DebugName(); | 10976 String* name = shared()->DebugName(); |
| 11011 return name->PassesFilter(raw_filter); | 10977 Vector<const char> filter = CStrVector(raw_filter); |
| 10978 if (filter.length() == 0) return name->length() == 0; |
| 10979 if (filter[0] == '-') { |
| 10980 // Negative filter. |
| 10981 if (filter.length() == 1) { |
| 10982 return (name->length() != 0); |
| 10983 } else if (name->IsUtf8EqualTo(filter.SubVector(1, filter.length()))) { |
| 10984 return false; |
| 10985 } |
| 10986 if (filter[filter.length() - 1] == '*' && |
| 10987 name->IsUtf8EqualTo(filter.SubVector(1, filter.length() - 1), true)) { |
| 10988 return false; |
| 10989 } |
| 10990 return true; |
| 10991 |
| 10992 } else if (name->IsUtf8EqualTo(filter)) { |
| 10993 return true; |
| 10994 } |
| 10995 if (filter[filter.length() - 1] == '*' && |
| 10996 name->IsUtf8EqualTo(filter.SubVector(0, filter.length() - 1), true)) { |
| 10997 return true; |
| 10998 } |
| 10999 return false; |
| 11012 } | 11000 } |
| 11013 | 11001 |
| 11014 | 11002 |
| 11015 Handle<String> JSFunction::GetDebugName(Handle<JSFunction> function) { | 11003 Handle<String> JSFunction::GetDebugName(Handle<JSFunction> function) { |
| 11016 Isolate* isolate = function->GetIsolate(); | 11004 Isolate* isolate = function->GetIsolate(); |
| 11017 Handle<Object> name = | 11005 Handle<Object> name = |
| 11018 JSReceiver::GetDataProperty(function, isolate->factory()->name_string()); | 11006 JSReceiver::GetDataProperty(function, isolate->factory()->name_string()); |
| 11019 if (name->IsString()) return Handle<String>::cast(name); | 11007 if (name->IsString()) return Handle<String>::cast(name); |
| 11020 return handle(function->shared()->DebugName(), isolate); | 11008 return handle(function->shared()->DebugName(), isolate); |
| 11021 } | 11009 } |
| (...skipping 5888 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 16910 if (cell->value() != *new_value) { | 16898 if (cell->value() != *new_value) { |
| 16911 cell->set_value(*new_value); | 16899 cell->set_value(*new_value); |
| 16912 Isolate* isolate = cell->GetIsolate(); | 16900 Isolate* isolate = cell->GetIsolate(); |
| 16913 cell->dependent_code()->DeoptimizeDependentCodeGroup( | 16901 cell->dependent_code()->DeoptimizeDependentCodeGroup( |
| 16914 isolate, DependentCode::kPropertyCellChangedGroup); | 16902 isolate, DependentCode::kPropertyCellChangedGroup); |
| 16915 } | 16903 } |
| 16916 } | 16904 } |
| 16917 | 16905 |
| 16918 } // namespace internal | 16906 } // namespace internal |
| 16919 } // namespace v8 | 16907 } // namespace v8 |
| OLD | NEW |