| OLD | NEW |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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 <stdlib.h> | 5 #include <stdlib.h> |
| 6 #include <sstream> | 6 #include <sstream> |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "src/api.h" | 9 #include "src/api.h" |
| 10 #include "src/objects.h" | 10 #include "src/objects.h" |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 FieldIndex index = FieldIndex::ForPropertyIndex(obj->map(), property_index); | 92 FieldIndex index = FieldIndex::ForPropertyIndex(obj->map(), property_index); |
| 93 return obj->RawFastPropertyAt(index); | 93 return obj->RawFastPropertyAt(index); |
| 94 } | 94 } |
| 95 | 95 |
| 96 | 96 |
| 97 static double GetDoubleFieldValue(JSObject* obj, FieldIndex field_index) { | 97 static double GetDoubleFieldValue(JSObject* obj, FieldIndex field_index) { |
| 98 if (obj->IsUnboxedDoubleField(field_index)) { | 98 if (obj->IsUnboxedDoubleField(field_index)) { |
| 99 return obj->RawFastDoublePropertyAt(field_index); | 99 return obj->RawFastDoublePropertyAt(field_index); |
| 100 } else { | 100 } else { |
| 101 Object* value = obj->RawFastPropertyAt(field_index); | 101 Object* value = obj->RawFastPropertyAt(field_index); |
| 102 DCHECK(value->IsMutableHeapNumber()); | 102 CHECK(value->IsMutableHeapNumber()); |
| 103 return HeapNumber::cast(value)->value(); | 103 return HeapNumber::cast(value)->value(); |
| 104 } | 104 } |
| 105 } | 105 } |
| 106 | 106 |
| 107 | 107 |
| 108 static double GetDoubleFieldValue(JSObject* obj, int property_index) { | 108 static double GetDoubleFieldValue(JSObject* obj, int property_index) { |
| 109 FieldIndex index = FieldIndex::ForPropertyIndex(obj->map(), property_index); | 109 FieldIndex index = FieldIndex::ForPropertyIndex(obj->map(), property_index); |
| 110 return GetDoubleFieldValue(obj, index); | 110 return GetDoubleFieldValue(obj, index); |
| 111 } | 111 } |
| 112 | 112 |
| (...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 571 // This test works only for if the total property count is less than maximum | 571 // This test works only for if the total property count is less than maximum |
| 572 // in-object properties count. | 572 // in-object properties count. |
| 573 static void TestClassHierarchy(const std::vector<int>& hierarchy_desc, int n) { | 573 static void TestClassHierarchy(const std::vector<int>& hierarchy_desc, int n) { |
| 574 int fields_count = 0; | 574 int fields_count = 0; |
| 575 for (int cur_class = 0; cur_class < n; cur_class++) { | 575 for (int cur_class = 0; cur_class < n; cur_class++) { |
| 576 std::string class_name = GetClassName(cur_class); | 576 std::string class_name = GetClassName(cur_class); |
| 577 int fields_count_at_current_level = hierarchy_desc[cur_class]; | 577 int fields_count_at_current_level = hierarchy_desc[cur_class]; |
| 578 fields_count += fields_count_at_current_level; | 578 fields_count += fields_count_at_current_level; |
| 579 | 579 |
| 580 // This test is not suitable for in-object properties count overflow case. | 580 // This test is not suitable for in-object properties count overflow case. |
| 581 DCHECK_LT(fields_count, kMaxInobjectProperties); | 581 CHECK_LT(fields_count, kMaxInobjectProperties); |
| 582 | 582 |
| 583 // Create |class_name| objects and check slack tracking. | 583 // Create |class_name| objects and check slack tracking. |
| 584 v8::Local<v8::Script> new_script = GetNewObjectScript(class_name); | 584 v8::Local<v8::Script> new_script = GetNewObjectScript(class_name); |
| 585 | 585 |
| 586 Handle<JSFunction> func = GetLexical<JSFunction>(class_name); | 586 Handle<JSFunction> func = GetLexical<JSFunction>(class_name); |
| 587 | 587 |
| 588 Handle<JSObject> obj = Run<JSObject>(new_script); | 588 Handle<JSObject> obj = Run<JSObject>(new_script); |
| 589 | 589 |
| 590 CHECK(func->has_initial_map()); | 590 CHECK(func->has_initial_map()); |
| 591 Handle<Map> initial_map(func->initial_map()); | 591 Handle<Map> initial_map(func->initial_map()); |
| (...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1089 TestSubclassBuiltin("A1", JS_PROMISE_TYPE, "Promise", | 1089 TestSubclassBuiltin("A1", JS_PROMISE_TYPE, "Promise", |
| 1090 "function(resolve, reject) { resolve('ok'); }", | 1090 "function(resolve, reject) { resolve('ok'); }", |
| 1091 first_field); | 1091 first_field); |
| 1092 } | 1092 } |
| 1093 | 1093 |
| 1094 | 1094 |
| 1095 TEST(SubclassPromiseBuiltinNoInlineNew) { | 1095 TEST(SubclassPromiseBuiltinNoInlineNew) { |
| 1096 FLAG_inline_new = false; | 1096 FLAG_inline_new = false; |
| 1097 TestSubclassPromiseBuiltin(); | 1097 TestSubclassPromiseBuiltin(); |
| 1098 } | 1098 } |
| OLD | NEW |