OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 19797 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
19808 TEST(SecondaryStubCache) { | 19808 TEST(SecondaryStubCache) { |
19809 StubCacheHelper(true); | 19809 StubCacheHelper(true); |
19810 } | 19810 } |
19811 | 19811 |
19812 | 19812 |
19813 TEST(PrimaryStubCache) { | 19813 TEST(PrimaryStubCache) { |
19814 StubCacheHelper(false); | 19814 StubCacheHelper(false); |
19815 } | 19815 } |
19816 | 19816 |
19817 | 19817 |
| 19818 static int cow_arrays_created_runtime = 0; |
| 19819 |
| 19820 |
| 19821 static int* LookupCounterCOWArrays(const char* name) { |
| 19822 if (strcmp(name, "c:V8.COWArraysCreatedRuntime") == 0) { |
| 19823 return &cow_arrays_created_runtime; |
| 19824 } |
| 19825 return NULL; |
| 19826 } |
| 19827 |
| 19828 |
| 19829 TEST(CheckCOWArraysCreatedRuntimeCounter) { |
| 19830 V8::SetCounterFunction(LookupCounterCOWArrays); |
| 19831 #ifdef DEBUG |
| 19832 i::FLAG_native_code_counters = true; |
| 19833 LocalContext env; |
| 19834 v8::HandleScope scope(env->GetIsolate()); |
| 19835 int initial_cow_arrays = cow_arrays_created_runtime; |
| 19836 CompileRun("var o = [1, 2, 3];"); |
| 19837 CHECK_EQ(1, cow_arrays_created_runtime - initial_cow_arrays); |
| 19838 CompileRun("var o = {foo: [4, 5, 6], bar: [3, 0]};"); |
| 19839 CHECK_EQ(3, cow_arrays_created_runtime - initial_cow_arrays); |
| 19840 CompileRun("var o = {foo: [1, 2, 3, [4, 5, 6]], bar: 'hi'};"); |
| 19841 CHECK_EQ(4, cow_arrays_created_runtime - initial_cow_arrays); |
| 19842 #endif |
| 19843 } |
| 19844 |
| 19845 |
19818 TEST(StaticGetters) { | 19846 TEST(StaticGetters) { |
19819 LocalContext context; | 19847 LocalContext context; |
19820 i::Factory* factory = CcTest::i_isolate()->factory(); | 19848 i::Factory* factory = CcTest::i_isolate()->factory(); |
19821 v8::Isolate* isolate = CcTest::isolate(); | 19849 v8::Isolate* isolate = CcTest::isolate(); |
19822 v8::HandleScope scope(isolate); | 19850 v8::HandleScope scope(isolate); |
19823 i::Handle<i::Object> undefined_value = factory->undefined_value(); | 19851 i::Handle<i::Object> undefined_value = factory->undefined_value(); |
19824 CHECK(*v8::Utils::OpenHandle(*v8::Undefined(isolate)) == *undefined_value); | 19852 CHECK(*v8::Utils::OpenHandle(*v8::Undefined(isolate)) == *undefined_value); |
19825 i::Handle<i::Object> null_value = factory->null_value(); | 19853 i::Handle<i::Object> null_value = factory->null_value(); |
19826 CHECK(*v8::Utils::OpenHandle(*v8::Null(isolate)) == *null_value); | 19854 CHECK(*v8::Utils::OpenHandle(*v8::Null(isolate)) == *null_value); |
19827 i::Handle<i::Object> true_value = factory->true_value(); | 19855 i::Handle<i::Object> true_value = factory->true_value(); |
(...skipping 883 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
20711 } | 20739 } |
20712 for (int i = 0; i < runs; i++) { | 20740 for (int i = 0; i < runs; i++) { |
20713 Local<String> expected; | 20741 Local<String> expected; |
20714 if (i != 0) { | 20742 if (i != 0) { |
20715 CHECK_EQ(v8_str("escape value"), values[i]); | 20743 CHECK_EQ(v8_str("escape value"), values[i]); |
20716 } else { | 20744 } else { |
20717 CHECK(values[i].IsEmpty()); | 20745 CHECK(values[i].IsEmpty()); |
20718 } | 20746 } |
20719 } | 20747 } |
20720 } | 20748 } |
OLD | NEW |