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