| 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 1525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1536 | 1536 |
| 1537 void String::PrintUC16(std::ostream& os, int start, int end) { // NOLINT | 1537 void String::PrintUC16(std::ostream& os, int start, int end) { // NOLINT |
| 1538 if (end < 0) end = length(); | 1538 if (end < 0) end = length(); |
| 1539 StringCharacterStream stream(this, start); | 1539 StringCharacterStream stream(this, start); |
| 1540 for (int i = start; i < end && stream.HasMore(); i++) { | 1540 for (int i = start; i < end && stream.HasMore(); i++) { |
| 1541 os << AsUC16(stream.GetNext()); | 1541 os << AsUC16(stream.GetNext()); |
| 1542 } | 1542 } |
| 1543 } | 1543 } |
| 1544 | 1544 |
| 1545 | 1545 |
| 1546 // The filter is a pattern that matches string names in this way: |
| 1547 // "*" all; the default |
| 1548 // "-name" all but "name" |
| 1549 // "name" only the function "name" |
| 1550 // "name*" only functions starting with "name" |
| 1551 // "~" none; the tilde is not an identifier |
| 1552 bool String::PassesFilter(const char* raw_filter) { |
| 1553 if (*raw_filter == '*') return true; |
| 1554 |
| 1555 Vector<const char> filter = CStrVector(raw_filter); |
| 1556 if (filter.length() == 0) return length() == 0; |
| 1557 if (filter[0] == '-') { |
| 1558 // Negative filter. |
| 1559 if (filter.length() == 1) { |
| 1560 return (length() != 0); |
| 1561 } else if (IsUtf8EqualTo(filter.SubVector(1, filter.length()))) { |
| 1562 return false; |
| 1563 } |
| 1564 if (filter[filter.length() - 1] == '*' && |
| 1565 IsUtf8EqualTo(filter.SubVector(1, filter.length() - 1), true)) { |
| 1566 return false; |
| 1567 } |
| 1568 return true; |
| 1569 |
| 1570 } else if (IsUtf8EqualTo(filter)) { |
| 1571 return true; |
| 1572 } |
| 1573 if (filter[filter.length() - 1] == '*' && |
| 1574 IsUtf8EqualTo(filter.SubVector(0, filter.length() - 1), true)) { |
| 1575 return true; |
| 1576 } |
| 1577 return false; |
| 1578 } |
| 1579 |
| 1580 |
| 1546 void JSObject::JSObjectShortPrint(StringStream* accumulator) { | 1581 void JSObject::JSObjectShortPrint(StringStream* accumulator) { |
| 1547 switch (map()->instance_type()) { | 1582 switch (map()->instance_type()) { |
| 1548 case JS_ARRAY_TYPE: { | 1583 case JS_ARRAY_TYPE: { |
| 1549 double length = JSArray::cast(this)->length()->IsUndefined() | 1584 double length = JSArray::cast(this)->length()->IsUndefined() |
| 1550 ? 0 | 1585 ? 0 |
| 1551 : JSArray::cast(this)->length()->Number(); | 1586 : JSArray::cast(this)->length()->Number(); |
| 1552 accumulator->Add("<JS Array[%u]>", static_cast<uint32_t>(length)); | 1587 accumulator->Add("<JS Array[%u]>", static_cast<uint32_t>(length)); |
| 1553 break; | 1588 break; |
| 1554 } | 1589 } |
| 1555 case JS_WEAK_MAP_TYPE: { | 1590 case JS_WEAK_MAP_TYPE: { |
| (...skipping 9380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10936 | 10971 |
| 10937 // The filter is a pattern that matches function names in this way: | 10972 // The filter is a pattern that matches function names in this way: |
| 10938 // "*" all; the default | 10973 // "*" all; the default |
| 10939 // "-" all but the top-level function | 10974 // "-" all but the top-level function |
| 10940 // "-name" all but the function "name" | 10975 // "-name" all but the function "name" |
| 10941 // "" only the top-level function | 10976 // "" only the top-level function |
| 10942 // "name" only the function "name" | 10977 // "name" only the function "name" |
| 10943 // "name*" only functions starting with "name" | 10978 // "name*" only functions starting with "name" |
| 10944 // "~" none; the tilde is not an identifier | 10979 // "~" none; the tilde is not an identifier |
| 10945 bool JSFunction::PassesFilter(const char* raw_filter) { | 10980 bool JSFunction::PassesFilter(const char* raw_filter) { |
| 10946 if (*raw_filter == '*') return true; | |
| 10947 String* name = shared()->DebugName(); | 10981 String* name = shared()->DebugName(); |
| 10948 Vector<const char> filter = CStrVector(raw_filter); | 10982 return name->PassesFilter(raw_filter); |
| 10949 if (filter.length() == 0) return name->length() == 0; | |
| 10950 if (filter[0] == '-') { | |
| 10951 // Negative filter. | |
| 10952 if (filter.length() == 1) { | |
| 10953 return (name->length() != 0); | |
| 10954 } else if (name->IsUtf8EqualTo(filter.SubVector(1, filter.length()))) { | |
| 10955 return false; | |
| 10956 } | |
| 10957 if (filter[filter.length() - 1] == '*' && | |
| 10958 name->IsUtf8EqualTo(filter.SubVector(1, filter.length() - 1), true)) { | |
| 10959 return false; | |
| 10960 } | |
| 10961 return true; | |
| 10962 | |
| 10963 } else if (name->IsUtf8EqualTo(filter)) { | |
| 10964 return true; | |
| 10965 } | |
| 10966 if (filter[filter.length() - 1] == '*' && | |
| 10967 name->IsUtf8EqualTo(filter.SubVector(0, filter.length() - 1), true)) { | |
| 10968 return true; | |
| 10969 } | |
| 10970 return false; | |
| 10971 } | 10983 } |
| 10972 | 10984 |
| 10973 | 10985 |
| 10974 Handle<String> JSFunction::GetDebugName(Handle<JSFunction> function) { | 10986 Handle<String> JSFunction::GetDebugName(Handle<JSFunction> function) { |
| 10975 Isolate* isolate = function->GetIsolate(); | 10987 Isolate* isolate = function->GetIsolate(); |
| 10976 Handle<Object> name = | 10988 Handle<Object> name = |
| 10977 JSReceiver::GetDataProperty(function, isolate->factory()->name_string()); | 10989 JSReceiver::GetDataProperty(function, isolate->factory()->name_string()); |
| 10978 if (name->IsString()) return Handle<String>::cast(name); | 10990 if (name->IsString()) return Handle<String>::cast(name); |
| 10979 return handle(function->shared()->DebugName(), isolate); | 10991 return handle(function->shared()->DebugName(), isolate); |
| 10980 } | 10992 } |
| (...skipping 5887 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 16868 if (cell->value() != *new_value) { | 16880 if (cell->value() != *new_value) { |
| 16869 cell->set_value(*new_value); | 16881 cell->set_value(*new_value); |
| 16870 Isolate* isolate = cell->GetIsolate(); | 16882 Isolate* isolate = cell->GetIsolate(); |
| 16871 cell->dependent_code()->DeoptimizeDependentCodeGroup( | 16883 cell->dependent_code()->DeoptimizeDependentCodeGroup( |
| 16872 isolate, DependentCode::kPropertyCellChangedGroup); | 16884 isolate, DependentCode::kPropertyCellChangedGroup); |
| 16873 } | 16885 } |
| 16874 } | 16886 } |
| 16875 | 16887 |
| 16876 } // namespace internal | 16888 } // namespace internal |
| 16877 } // namespace v8 | 16889 } // namespace v8 |
| OLD | NEW |