Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(338)

Side by Side Diff: test/cctest/test-api.cc

Issue 22710007: Revert "Promote ArrayBuffer, DataView and typed arrays to non-experimental." (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « test/cctest/cctest.cc ('k') | test/cctest/test-heap.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 2664 matching lines...) Expand 10 before | Expand all | Expand 10 after
2675 template <typename T> 2675 template <typename T>
2676 static void CheckInternalFieldsAreZero(v8::Handle<T> value) { 2676 static void CheckInternalFieldsAreZero(v8::Handle<T> value) {
2677 CHECK_EQ(T::kInternalFieldCount, value->InternalFieldCount()); 2677 CHECK_EQ(T::kInternalFieldCount, value->InternalFieldCount());
2678 for (int i = 0; i < value->InternalFieldCount(); i++) { 2678 for (int i = 0; i < value->InternalFieldCount(); i++) {
2679 CHECK_EQ(0, value->GetInternalField(i)->Int32Value()); 2679 CHECK_EQ(0, value->GetInternalField(i)->Int32Value());
2680 } 2680 }
2681 } 2681 }
2682 2682
2683 2683
2684 THREADED_TEST(ArrayBuffer_ApiInternalToExternal) { 2684 THREADED_TEST(ArrayBuffer_ApiInternalToExternal) {
2685 i::FLAG_harmony_array_buffer = true;
2686 i::FLAG_harmony_typed_arrays = true;
2687
2685 LocalContext env; 2688 LocalContext env;
2686 v8::Isolate* isolate = env->GetIsolate(); 2689 v8::Isolate* isolate = env->GetIsolate();
2687 v8::HandleScope handle_scope(isolate); 2690 v8::HandleScope handle_scope(isolate);
2688 2691
2689 Local<v8::ArrayBuffer> ab = v8::ArrayBuffer::New(1024); 2692 Local<v8::ArrayBuffer> ab = v8::ArrayBuffer::New(1024);
2690 CheckInternalFieldsAreZero(ab); 2693 CheckInternalFieldsAreZero(ab);
2691 CHECK_EQ(1024, static_cast<int>(ab->ByteLength())); 2694 CHECK_EQ(1024, static_cast<int>(ab->ByteLength()));
2692 CHECK(!ab->IsExternal()); 2695 CHECK(!ab->IsExternal());
2693 HEAP->CollectAllGarbage(i::Heap::kNoGCFlags); 2696 HEAP->CollectAllGarbage(i::Heap::kNoGCFlags);
2694 2697
(...skipping 16 matching lines...) Expand all
2711 CHECK_EQ(0xFF, data[0]); 2714 CHECK_EQ(0xFF, data[0]);
2712 CHECK_EQ(0xAA, data[1]); 2715 CHECK_EQ(0xAA, data[1]);
2713 data[0] = 0xCC; 2716 data[0] = 0xCC;
2714 data[1] = 0x11; 2717 data[1] = 0x11;
2715 result = CompileRun("u8[0] + u8[1]"); 2718 result = CompileRun("u8[0] + u8[1]");
2716 CHECK_EQ(0xDD, result->Int32Value()); 2719 CHECK_EQ(0xDD, result->Int32Value());
2717 } 2720 }
2718 2721
2719 2722
2720 THREADED_TEST(ArrayBuffer_JSInternalToExternal) { 2723 THREADED_TEST(ArrayBuffer_JSInternalToExternal) {
2724 i::FLAG_harmony_array_buffer = true;
2725 i::FLAG_harmony_typed_arrays = true;
2726
2721 LocalContext env; 2727 LocalContext env;
2722 v8::Isolate* isolate = env->GetIsolate(); 2728 v8::Isolate* isolate = env->GetIsolate();
2723 v8::HandleScope handle_scope(isolate); 2729 v8::HandleScope handle_scope(isolate);
2724 2730
2725 2731
2726 v8::Local<v8::Value> result = 2732 v8::Local<v8::Value> result =
2727 CompileRun("var ab1 = new ArrayBuffer(2);" 2733 CompileRun("var ab1 = new ArrayBuffer(2);"
2728 "var u8_a = new Uint8Array(ab1);" 2734 "var u8_a = new Uint8Array(ab1);"
2729 "u8_a[0] = 0xAA;" 2735 "u8_a[0] = 0xAA;"
2730 "u8_a[1] = 0xFF; u8_a.buffer"); 2736 "u8_a[1] = 0xFF; u8_a.buffer");
(...skipping 22 matching lines...) Expand all
2753 CHECK_EQ(0xBB, ab1_data[0]); 2759 CHECK_EQ(0xBB, ab1_data[0]);
2754 CHECK_EQ(0xFF, ab1_data[1]); 2760 CHECK_EQ(0xFF, ab1_data[1]);
2755 ab1_data[0] = 0xCC; 2761 ab1_data[0] = 0xCC;
2756 ab1_data[1] = 0x11; 2762 ab1_data[1] = 0x11;
2757 result = CompileRun("u8_a[0] + u8_a[1]"); 2763 result = CompileRun("u8_a[0] + u8_a[1]");
2758 CHECK_EQ(0xDD, result->Int32Value()); 2764 CHECK_EQ(0xDD, result->Int32Value());
2759 } 2765 }
2760 2766
2761 2767
2762 THREADED_TEST(ArrayBuffer_External) { 2768 THREADED_TEST(ArrayBuffer_External) {
2769 i::FLAG_harmony_array_buffer = true;
2770 i::FLAG_harmony_typed_arrays = true;
2771
2763 LocalContext env; 2772 LocalContext env;
2764 v8::Isolate* isolate = env->GetIsolate(); 2773 v8::Isolate* isolate = env->GetIsolate();
2765 v8::HandleScope handle_scope(isolate); 2774 v8::HandleScope handle_scope(isolate);
2766 2775
2767 i::ScopedVector<uint8_t> my_data(100); 2776 i::ScopedVector<uint8_t> my_data(100);
2768 memset(my_data.start(), 0, 100); 2777 memset(my_data.start(), 0, 100);
2769 Local<v8::ArrayBuffer> ab3 = v8::ArrayBuffer::New(my_data.start(), 100); 2778 Local<v8::ArrayBuffer> ab3 = v8::ArrayBuffer::New(my_data.start(), 100);
2770 CheckInternalFieldsAreZero(ab3); 2779 CheckInternalFieldsAreZero(ab3);
2771 CHECK_EQ(100, static_cast<int>(ab3->ByteLength())); 2780 CHECK_EQ(100, static_cast<int>(ab3->ByteLength()));
2772 CHECK(ab3->IsExternal()); 2781 CHECK(ab3->IsExternal());
(...skipping 10169 matching lines...) Expand 10 before | Expand all | Expand 10 after
12942 12951
12943 isolate->Dispose(); 12952 isolate->Dispose();
12944 } 12953 }
12945 12954
12946 12955
12947 TEST(SetFunctionEntryHook) { 12956 TEST(SetFunctionEntryHook) {
12948 // FunctionEntryHook does not work well with experimental natives. 12957 // FunctionEntryHook does not work well with experimental natives.
12949 // Experimental natives are compiled during snapshot deserialization. 12958 // Experimental natives are compiled during snapshot deserialization.
12950 // This test breaks because InstallGetter (function from snapshot that 12959 // This test breaks because InstallGetter (function from snapshot that
12951 // only gets called from experimental natives) is compiled with entry hooks. 12960 // only gets called from experimental natives) is compiled with entry hooks.
12961 i::FLAG_harmony_typed_arrays = false;
12962 i::FLAG_harmony_array_buffer = false;
12963
12952 i::FLAG_allow_natives_syntax = true; 12964 i::FLAG_allow_natives_syntax = true;
12953 i::FLAG_use_inlining = false; 12965 i::FLAG_use_inlining = false;
12954 12966
12955 SetFunctionEntryHookTest test; 12967 SetFunctionEntryHookTest test;
12956 test.RunTest(); 12968 test.RunTest();
12957 } 12969 }
12958 12970
12959 12971
12960 static i::HashMap* code_map = NULL; 12972 static i::HashMap* code_map = NULL;
12961 static i::HashMap* jitcode_line_info = NULL; 12973 static i::HashMap* jitcode_line_info = NULL;
(...skipping 3176 matching lines...) Expand 10 before | Expand all | Expand 10 after
16138 v8::DataView::New(ab, 2, kSize); 16150 v8::DataView::New(ab, 2, kSize);
16139 CheckInternalFieldsAreZero<v8::ArrayBufferView>(dv); 16151 CheckInternalFieldsAreZero<v8::ArrayBufferView>(dv);
16140 CHECK_EQ(2, static_cast<int>(dv->ByteOffset())); 16152 CHECK_EQ(2, static_cast<int>(dv->ByteOffset()));
16141 CHECK_EQ(kSize, static_cast<int>(dv->ByteLength())); 16153 CHECK_EQ(kSize, static_cast<int>(dv->ByteLength()));
16142 CHECK_EQ(ab, dv->Buffer()); 16154 CHECK_EQ(ab, dv->Buffer());
16143 } 16155 }
16144 16156
16145 16157
16146 #define IS_ARRAY_BUFFER_VIEW_TEST(View) \ 16158 #define IS_ARRAY_BUFFER_VIEW_TEST(View) \
16147 THREADED_TEST(Is##View) { \ 16159 THREADED_TEST(Is##View) { \
16160 i::FLAG_harmony_array_buffer = true; \
16161 i::FLAG_harmony_typed_arrays = true; \
16148 LocalContext env; \ 16162 LocalContext env; \
16149 v8::Isolate* isolate = env->GetIsolate(); \ 16163 v8::Isolate* isolate = env->GetIsolate(); \
16150 v8::HandleScope handle_scope(isolate); \ 16164 v8::HandleScope handle_scope(isolate); \
16151 \ 16165 \
16152 Handle<Value> result = CompileRun( \ 16166 Handle<Value> result = CompileRun( \
16153 "var ab = new ArrayBuffer(128);" \ 16167 "var ab = new ArrayBuffer(128);" \
16154 "new " #View "(ab)"); \ 16168 "new " #View "(ab)"); \
16155 CHECK(result->IsArrayBufferView()); \ 16169 CHECK(result->IsArrayBufferView()); \
16156 CHECK(result->Is##View()); \ 16170 CHECK(result->Is##View()); \
16157 CheckInternalFieldsAreZero<v8::ArrayBufferView>(result.As<v8::View>()); \ 16171 CheckInternalFieldsAreZero<v8::ArrayBufferView>(result.As<v8::View>()); \
(...skipping 3995 matching lines...) Expand 10 before | Expand all | Expand 10 after
20153 CheckCorrectThrow("%HasProperty(other, 'x')"); 20167 CheckCorrectThrow("%HasProperty(other, 'x')");
20154 CheckCorrectThrow("%HasElement(other, 1)"); 20168 CheckCorrectThrow("%HasElement(other, 1)");
20155 CheckCorrectThrow("%IsPropertyEnumerable(other, 'x')"); 20169 CheckCorrectThrow("%IsPropertyEnumerable(other, 'x')");
20156 CheckCorrectThrow("%GetPropertyNames(other)"); 20170 CheckCorrectThrow("%GetPropertyNames(other)");
20157 CheckCorrectThrow("%GetLocalPropertyNames(other, true)"); 20171 CheckCorrectThrow("%GetLocalPropertyNames(other, true)");
20158 CheckCorrectThrow("%DefineOrRedefineAccessorProperty(" 20172 CheckCorrectThrow("%DefineOrRedefineAccessorProperty("
20159 "other, 'x', null, null, 1)"); 20173 "other, 'x', null, null, 1)");
20160 } 20174 }
20161 20175
20162 #endif // WIN32 20176 #endif // WIN32
OLDNEW
« no previous file with comments | « test/cctest/cctest.cc ('k') | test/cctest/test-heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698