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

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

Issue 143633007: A64: Synchronize with r18764. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 10 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/profiler-extension.cc ('k') | test/cctest/test-ast.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 1981 matching lines...) Expand 10 before | Expand all | Expand 10 after
1992 LocalContext env; 1992 LocalContext env;
1993 env->Global()->Set(v8_str("Child"), child->GetFunction()); 1993 env->Global()->Set(v8_str("Child"), child->GetFunction());
1994 CompileRun("var child = new Child;" 1994 CompileRun("var child = new Child;"
1995 "child.age = 10;"); 1995 "child.age = 10;");
1996 ExpectBoolean("child.hasOwnProperty('age')", false); 1996 ExpectBoolean("child.hasOwnProperty('age')", false);
1997 ExpectInt32("child.age", 10); 1997 ExpectInt32("child.age", 10);
1998 ExpectInt32("child.accessor_age", 10); 1998 ExpectInt32("child.accessor_age", 10);
1999 } 1999 }
2000 2000
2001 2001
2002 THREADED_TEST(EmptyInterceptorBreakTransitions) {
2003 v8::HandleScope scope(CcTest::isolate());
2004 Handle<FunctionTemplate> templ = FunctionTemplate::New(CcTest::isolate());
2005 AddInterceptor(templ, EmptyInterceptorGetter, EmptyInterceptorSetter);
2006 LocalContext env;
2007 env->Global()->Set(v8_str("Constructor"), templ->GetFunction());
2008 CompileRun("var o1 = new Constructor;"
2009 "o1.a = 1;" // Ensure a and x share the descriptor array.
2010 "Object.defineProperty(o1, 'x', {value: 10});");
2011 CompileRun("var o2 = new Constructor;"
2012 "o2.a = 1;"
2013 "Object.defineProperty(o2, 'x', {value: 10});");
2014 }
2015
2016
2002 THREADED_TEST(EmptyInterceptorDoesNotShadowJSAccessors) { 2017 THREADED_TEST(EmptyInterceptorDoesNotShadowJSAccessors) {
2003 v8::Isolate* isolate = CcTest::isolate(); 2018 v8::Isolate* isolate = CcTest::isolate();
2004 v8::HandleScope scope(isolate); 2019 v8::HandleScope scope(isolate);
2005 Handle<FunctionTemplate> parent = FunctionTemplate::New(isolate); 2020 Handle<FunctionTemplate> parent = FunctionTemplate::New(isolate);
2006 Handle<FunctionTemplate> child = FunctionTemplate::New(isolate); 2021 Handle<FunctionTemplate> child = FunctionTemplate::New(isolate);
2007 child->Inherit(parent); 2022 child->Inherit(parent);
2008 AddInterceptor(child, EmptyInterceptorGetter, EmptyInterceptorSetter); 2023 AddInterceptor(child, EmptyInterceptorGetter, EmptyInterceptorSetter);
2009 LocalContext env; 2024 LocalContext env;
2010 env->Global()->Set(v8_str("Child"), child->GetFunction()); 2025 env->Global()->Set(v8_str("Child"), child->GetFunction());
2011 CompileRun("var child = new Child;" 2026 CompileRun("var child = new Child;"
(...skipping 5102 matching lines...) Expand 10 before | Expand all | Expand 10 after
7114 prev.SetWeak<Value, Snorkel<Value> >(new Snorkel<Value>(&prev.As<Value>()), 7129 prev.SetWeak<Value, Snorkel<Value> >(new Snorkel<Value>(&prev.As<Value>()),
7115 &HandleWeakReference); 7130 &HandleWeakReference);
7116 } 7131 }
7117 whammy->objects_[whammy->cursor_].Reset(info.GetIsolate(), obj); 7132 whammy->objects_[whammy->cursor_].Reset(info.GetIsolate(), obj);
7118 whammy->cursor_ = (whammy->cursor_ + 1) % Whammy::kObjectCount; 7133 whammy->cursor_ = (whammy->cursor_ + 1) % Whammy::kObjectCount;
7119 info.GetReturnValue().Set(whammy->getScript()->Run()); 7134 info.GetReturnValue().Set(whammy->getScript()->Run());
7120 } 7135 }
7121 7136
7122 7137
7123 THREADED_TEST(WeakReference) { 7138 THREADED_TEST(WeakReference) {
7139 i::FLAG_expose_gc = true;
7124 v8::Isolate* isolate = CcTest::isolate(); 7140 v8::Isolate* isolate = CcTest::isolate();
7125 v8::HandleScope handle_scope(isolate); 7141 v8::HandleScope handle_scope(isolate);
7126 v8::Handle<v8::ObjectTemplate> templ= v8::ObjectTemplate::New(isolate); 7142 v8::Handle<v8::ObjectTemplate> templ= v8::ObjectTemplate::New(isolate);
7127 Whammy* whammy = new Whammy(CcTest::isolate()); 7143 Whammy* whammy = new Whammy(CcTest::isolate());
7128 templ->SetNamedPropertyHandler(WhammyPropertyGetter, 7144 templ->SetNamedPropertyHandler(WhammyPropertyGetter,
7129 0, 0, 0, 0, 7145 0, 0, 0, 0,
7130 v8::External::New(CcTest::isolate(), whammy)); 7146 v8::External::New(CcTest::isolate(), whammy));
7131 const char* extension_list[] = { "v8/gc" }; 7147 const char* extension_list[] = { "v8/gc" };
7132 v8::ExtensionConfiguration extensions(1, extension_list); 7148 v8::ExtensionConfiguration extensions(1, extension_list);
7133 v8::Handle<Context> context = 7149 v8::Handle<Context> context =
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after
7607 7623
7608 7624
7609 THREADED_TEST(StringWrite) { 7625 THREADED_TEST(StringWrite) {
7610 LocalContext context; 7626 LocalContext context;
7611 v8::HandleScope scope(context->GetIsolate()); 7627 v8::HandleScope scope(context->GetIsolate());
7612 v8::Handle<String> str = v8_str("abcde"); 7628 v8::Handle<String> str = v8_str("abcde");
7613 // abc<Icelandic eth><Unicode snowman>. 7629 // abc<Icelandic eth><Unicode snowman>.
7614 v8::Handle<String> str2 = v8_str("abc\303\260\342\230\203"); 7630 v8::Handle<String> str2 = v8_str("abc\303\260\342\230\203");
7615 v8::Handle<String> str3 = v8::String::NewFromUtf8( 7631 v8::Handle<String> str3 = v8::String::NewFromUtf8(
7616 context->GetIsolate(), "abc\0def", v8::String::kNormalString, 7); 7632 context->GetIsolate(), "abc\0def", v8::String::kNormalString, 7);
7633 // "ab" + lead surrogate + "cd" + trail surrogate + "ef"
7634 uint16_t orphans[8] = { 0x61, 0x62, 0xd800, 0x63, 0x64, 0xdc00, 0x65, 0x66 };
7635 v8::Handle<String> orphans_str = v8::String::NewFromTwoByte(
7636 context->GetIsolate(), orphans, v8::String::kNormalString, 8);
7637 // single lead surrogate
7638 uint16_t lead[1] = { 0xd800 };
7639 v8::Handle<String> lead_str = v8::String::NewFromTwoByte(
7640 context->GetIsolate(), lead, v8::String::kNormalString, 1);
7641 // single trail surrogate
7642 uint16_t trail[1] = { 0xdc00 };
7643 v8::Handle<String> trail_str = v8::String::NewFromTwoByte(
7644 context->GetIsolate(), trail, v8::String::kNormalString, 1);
7645 // surrogate pair
7646 uint16_t pair[2] = { 0xd800, 0xdc00 };
7647 v8::Handle<String> pair_str = v8::String::NewFromTwoByte(
7648 context->GetIsolate(), pair, v8::String::kNormalString, 2);
7617 const int kStride = 4; // Must match stride in for loops in JS below. 7649 const int kStride = 4; // Must match stride in for loops in JS below.
7618 CompileRun( 7650 CompileRun(
7619 "var left = '';" 7651 "var left = '';"
7620 "for (var i = 0; i < 0xd800; i += 4) {" 7652 "for (var i = 0; i < 0xd800; i += 4) {"
7621 " left = left + String.fromCharCode(i);" 7653 " left = left + String.fromCharCode(i);"
7622 "}"); 7654 "}");
7623 CompileRun( 7655 CompileRun(
7624 "var right = '';" 7656 "var right = '';"
7625 "for (var i = 0; i < 0xd800; i += 4) {" 7657 "for (var i = 0; i < 0xd800; i += 4) {"
7626 " right = String.fromCharCode(i) + right;" 7658 " right = String.fromCharCode(i) + right;"
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
7680 CHECK_EQ(3, len); 7712 CHECK_EQ(3, len);
7681 CHECK_EQ(3, charlen); 7713 CHECK_EQ(3, charlen);
7682 CHECK_EQ(0, strncmp(utf8buf, "abc\1", 4)); 7714 CHECK_EQ(0, strncmp(utf8buf, "abc\1", 4));
7683 7715
7684 memset(utf8buf, 0x1, 1000); 7716 memset(utf8buf, 0x1, 1000);
7685 len = str2->WriteUtf8(utf8buf, 2, &charlen); 7717 len = str2->WriteUtf8(utf8buf, 2, &charlen);
7686 CHECK_EQ(2, len); 7718 CHECK_EQ(2, len);
7687 CHECK_EQ(2, charlen); 7719 CHECK_EQ(2, charlen);
7688 CHECK_EQ(0, strncmp(utf8buf, "ab\1", 3)); 7720 CHECK_EQ(0, strncmp(utf8buf, "ab\1", 3));
7689 7721
7722 // allow orphan surrogates by default
7723 memset(utf8buf, 0x1, 1000);
7724 len = orphans_str->WriteUtf8(utf8buf, sizeof(utf8buf), &charlen);
7725 CHECK_EQ(13, len);
7726 CHECK_EQ(8, charlen);
7727 CHECK_EQ(0, strcmp(utf8buf, "ab\355\240\200cd\355\260\200ef"));
7728
7729 // replace orphan surrogates with unicode replacement character
7730 memset(utf8buf, 0x1, 1000);
7731 len = orphans_str->WriteUtf8(utf8buf,
7732 sizeof(utf8buf),
7733 &charlen,
7734 String::REPLACE_INVALID_UTF8);
7735 CHECK_EQ(13, len);
7736 CHECK_EQ(8, charlen);
7737 CHECK_EQ(0, strcmp(utf8buf, "ab\357\277\275cd\357\277\275ef"));
7738
7739 // replace single lead surrogate with unicode replacement character
7740 memset(utf8buf, 0x1, 1000);
7741 len = lead_str->WriteUtf8(utf8buf,
7742 sizeof(utf8buf),
7743 &charlen,
7744 String::REPLACE_INVALID_UTF8);
7745 CHECK_EQ(4, len);
7746 CHECK_EQ(1, charlen);
7747 CHECK_EQ(0, strcmp(utf8buf, "\357\277\275"));
7748
7749 // replace single trail surrogate with unicode replacement character
7750 memset(utf8buf, 0x1, 1000);
7751 len = trail_str->WriteUtf8(utf8buf,
7752 sizeof(utf8buf),
7753 &charlen,
7754 String::REPLACE_INVALID_UTF8);
7755 CHECK_EQ(4, len);
7756 CHECK_EQ(1, charlen);
7757 CHECK_EQ(0, strcmp(utf8buf, "\357\277\275"));
7758
7759 // do not replace / write anything if surrogate pair does not fit the buffer
7760 // space
7761 memset(utf8buf, 0x1, 1000);
7762 len = pair_str->WriteUtf8(utf8buf,
7763 3,
7764 &charlen,
7765 String::REPLACE_INVALID_UTF8);
7766 CHECK_EQ(0, len);
7767 CHECK_EQ(0, charlen);
7768
7690 memset(utf8buf, 0x1, sizeof(utf8buf)); 7769 memset(utf8buf, 0x1, sizeof(utf8buf));
7691 len = GetUtf8Length(left_tree); 7770 len = GetUtf8Length(left_tree);
7692 int utf8_expected = 7771 int utf8_expected =
7693 (0x80 + (0x800 - 0x80) * 2 + (0xd800 - 0x800) * 3) / kStride; 7772 (0x80 + (0x800 - 0x80) * 2 + (0xd800 - 0x800) * 3) / kStride;
7694 CHECK_EQ(utf8_expected, len); 7773 CHECK_EQ(utf8_expected, len);
7695 len = left_tree->WriteUtf8(utf8buf, utf8_expected, &charlen); 7774 len = left_tree->WriteUtf8(utf8buf, utf8_expected, &charlen);
7696 CHECK_EQ(utf8_expected, len); 7775 CHECK_EQ(utf8_expected, len);
7697 CHECK_EQ(0xd800 / kStride, charlen); 7776 CHECK_EQ(0xd800 / kStride, charlen);
7698 CHECK_EQ(0xed, static_cast<unsigned char>(utf8buf[utf8_expected - 3])); 7777 CHECK_EQ(0xed, static_cast<unsigned char>(utf8buf[utf8_expected - 3]));
7699 CHECK_EQ(0x9f, static_cast<unsigned char>(utf8buf[utf8_expected - 2])); 7778 CHECK_EQ(0x9f, static_cast<unsigned char>(utf8buf[utf8_expected - 2]));
(...skipping 5709 matching lines...) Expand 10 before | Expand all | Expand 10 after
13409 #ifdef DEBUG 13488 #ifdef DEBUG
13410 if (count != expected) CcTest::heap()->TracePathToGlobal(); 13489 if (count != expected) CcTest::heap()->TracePathToGlobal();
13411 #endif 13490 #endif
13412 CHECK_EQ(expected, count); 13491 CHECK_EQ(expected, count);
13413 } 13492 }
13414 13493
13415 13494
13416 TEST(DontLeakGlobalObjects) { 13495 TEST(DontLeakGlobalObjects) {
13417 // Regression test for issues 1139850 and 1174891. 13496 // Regression test for issues 1139850 and 1174891.
13418 13497
13498 i::FLAG_expose_gc = true;
13419 v8::V8::Initialize(); 13499 v8::V8::Initialize();
13420 13500
13421 for (int i = 0; i < 5; i++) { 13501 for (int i = 0; i < 5; i++) {
13422 { v8::HandleScope scope(CcTest::isolate()); 13502 { v8::HandleScope scope(CcTest::isolate());
13423 LocalContext context; 13503 LocalContext context;
13424 } 13504 }
13425 v8::V8::ContextDisposedNotification(); 13505 v8::V8::ContextDisposedNotification();
13426 CheckSurvivingGlobalObjectsCount(0); 13506 CheckSurvivingGlobalObjectsCount(0);
13427 13507
13428 { v8::HandleScope scope(CcTest::isolate()); 13508 { v8::HandleScope scope(CcTest::isolate());
(...skipping 2677 matching lines...) Expand 10 before | Expand all | Expand 10 after
16106 i::Handle<i::JSObject> jsobj = v8::Utils::OpenHandle(*obj); 16186 i::Handle<i::JSObject> jsobj = v8::Utils::OpenHandle(*obj);
16107 i::Isolate* isolate = jsobj->GetIsolate(); 16187 i::Isolate* isolate = jsobj->GetIsolate();
16108 obj->Set(v8_str("field"), 16188 obj->Set(v8_str("field"),
16109 v8::Int32::New(reinterpret_cast<v8::Isolate*>(isolate), 1503)); 16189 v8::Int32::New(reinterpret_cast<v8::Isolate*>(isolate), 1503));
16110 context->Global()->Set(v8_str("ext_array"), obj); 16190 context->Global()->Set(v8_str("ext_array"), obj);
16111 v8::Handle<v8::Value> result = CompileRun("ext_array.field"); 16191 v8::Handle<v8::Value> result = CompileRun("ext_array.field");
16112 CHECK_EQ(1503, result->Int32Value()); 16192 CHECK_EQ(1503, result->Int32Value());
16113 result = CompileRun("ext_array[1]"); 16193 result = CompileRun("ext_array[1]");
16114 CHECK_EQ(1, result->Int32Value()); 16194 CHECK_EQ(1, result->Int32Value());
16115 16195
16116 // Check pass through of assigned smis
16117 result = CompileRun("var sum = 0;"
16118 "for (var i = 0; i < 8; i++) {"
16119 " sum += ext_array[i] = ext_array[i] = -i;"
16120 "}"
16121 "sum;");
16122 CHECK_EQ(-28, result->Int32Value());
16123
16124 // Check assigned smis 16196 // Check assigned smis
16125 result = CompileRun("for (var i = 0; i < 8; i++) {" 16197 result = CompileRun("for (var i = 0; i < 8; i++) {"
16126 " ext_array[i] = i;" 16198 " ext_array[i] = i;"
16127 "}" 16199 "}"
16128 "var sum = 0;" 16200 "var sum = 0;"
16129 "for (var i = 0; i < 8; i++) {" 16201 "for (var i = 0; i < 8; i++) {"
16130 " sum += ext_array[i];" 16202 " sum += ext_array[i];"
16131 "}" 16203 "}"
16132 "sum;"); 16204 "sum;");
16205
16133 CHECK_EQ(28, result->Int32Value()); 16206 CHECK_EQ(28, result->Int32Value());
16207 // Check pass through of assigned smis
16208 result = CompileRun("var sum = 0;"
16209 "for (var i = 0; i < 8; i++) {"
16210 " sum += ext_array[i] = ext_array[i] = -i;"
16211 "}"
16212 "sum;");
16213 CHECK_EQ(-28, result->Int32Value());
16214
16134 16215
16135 // Check assigned smis in reverse order 16216 // Check assigned smis in reverse order
16136 result = CompileRun("for (var i = 8; --i >= 0; ) {" 16217 result = CompileRun("for (var i = 8; --i >= 0; ) {"
16137 " ext_array[i] = i;" 16218 " ext_array[i] = i;"
16138 "}" 16219 "}"
16139 "var sum = 0;" 16220 "var sum = 0;"
16140 "for (var i = 0; i < 8; i++) {" 16221 "for (var i = 0; i < 8; i++) {"
16141 " sum += ext_array[i];" 16222 " sum += ext_array[i];"
16142 "}" 16223 "}"
16143 "sum;"); 16224 "sum;");
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
16391 "js_array.__proto__ = ext_array;" 16472 "js_array.__proto__ = ext_array;"
16392 "js_array.concat(ext_array);"); 16473 "js_array.concat(ext_array);");
16393 CHECK_EQ(77, v8::Object::Cast(*result)->Get(v8_str("0"))->Int32Value()); 16474 CHECK_EQ(77, v8::Object::Cast(*result)->Get(v8_str("0"))->Int32Value());
16394 CHECK_EQ(23, v8::Object::Cast(*result)->Get(v8_str("1"))->Int32Value()); 16475 CHECK_EQ(23, v8::Object::Cast(*result)->Get(v8_str("1"))->Int32Value());
16395 16476
16396 result = CompileRun("ext_array[1] = 23;"); 16477 result = CompileRun("ext_array[1] = 23;");
16397 CHECK_EQ(23, result->Int32Value()); 16478 CHECK_EQ(23, result->Int32Value());
16398 } 16479 }
16399 16480
16400 16481
16482 template <class FixedTypedArrayClass,
16483 i::ElementsKind elements_kind,
16484 class ElementType>
16485 static void FixedTypedArrayTestHelper(
16486 v8::ExternalArrayType array_type,
16487 ElementType low,
16488 ElementType high) {
16489 i::FLAG_allow_natives_syntax = true;
16490 LocalContext context;
16491 i::Isolate* isolate = CcTest::i_isolate();
16492 i::Factory* factory = isolate->factory();
16493 v8::HandleScope scope(context->GetIsolate());
16494 const int kElementCount = 260;
16495 i::Handle<FixedTypedArrayClass> fixed_array =
16496 i::Handle<FixedTypedArrayClass>::cast(
16497 factory->NewFixedTypedArray(kElementCount, array_type));
16498 CHECK_EQ(FixedTypedArrayClass::kInstanceType,
16499 fixed_array->map()->instance_type());
16500 CHECK_EQ(kElementCount, fixed_array->length());
16501 CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags);
16502 for (int i = 0; i < kElementCount; i++) {
16503 fixed_array->set(i, static_cast<ElementType>(i));
16504 }
16505 // Force GC to trigger verification.
16506 CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags);
16507 for (int i = 0; i < kElementCount; i++) {
16508 CHECK_EQ(static_cast<int64_t>(static_cast<ElementType>(i)),
16509 static_cast<int64_t>(fixed_array->get_scalar(i)));
16510 }
16511 v8::Handle<v8::Object> obj = v8::Object::New(CcTest::isolate());
16512 i::Handle<i::JSObject> jsobj = v8::Utils::OpenHandle(*obj);
16513 i::Handle<i::Map> fixed_array_map =
16514 isolate->factory()->GetElementsTransitionMap(jsobj, elements_kind);
16515 jsobj->set_map(*fixed_array_map);
16516 jsobj->set_elements(*fixed_array);
16517
16518 ObjectWithExternalArrayTestHelper<FixedTypedArrayClass, ElementType>(
16519 context.local(), obj, kElementCount, array_type,
16520 static_cast<int64_t>(low),
16521 static_cast<int64_t>(high));
16522 }
16523
16524
16525 THREADED_TEST(FixedUint8Array) {
16526 FixedTypedArrayTestHelper<i::FixedUint8Array, i::UINT8_ELEMENTS, uint8_t>(
16527 v8::kExternalUnsignedByteArray,
16528 0x0, 0xFF);
16529 }
16530
16531
16532 THREADED_TEST(FixedUint8ClampedArray) {
16533 FixedTypedArrayTestHelper<i::FixedUint8ClampedArray,
16534 i::UINT8_CLAMPED_ELEMENTS, uint8_t>(
16535 v8::kExternalPixelArray,
16536 0x0, 0xFF);
16537 }
16538
16539
16540 THREADED_TEST(FixedInt8Array) {
16541 FixedTypedArrayTestHelper<i::FixedInt8Array, i::INT8_ELEMENTS, int8_t>(
16542 v8::kExternalByteArray,
16543 -0x80, 0x7F);
16544 }
16545
16546
16547 THREADED_TEST(FixedUint16Array) {
16548 FixedTypedArrayTestHelper<i::FixedUint16Array, i::UINT16_ELEMENTS, uint16_t>(
16549 v8::kExternalUnsignedShortArray,
16550 0x0, 0xFFFF);
16551 }
16552
16553
16554 THREADED_TEST(FixedInt16Array) {
16555 FixedTypedArrayTestHelper<i::FixedInt16Array, i::INT16_ELEMENTS, int16_t>(
16556 v8::kExternalShortArray,
16557 -0x8000, 0x7FFF);
16558 }
16559
16560
16561 THREADED_TEST(FixedUint32Array) {
16562 FixedTypedArrayTestHelper<i::FixedUint32Array, i::UINT32_ELEMENTS, uint32_t>(
16563 v8::kExternalUnsignedIntArray,
16564 0x0, UINT_MAX);
16565 }
16566
16567
16568 THREADED_TEST(FixedInt32Array) {
16569 FixedTypedArrayTestHelper<i::FixedInt32Array, i::INT32_ELEMENTS, int32_t>(
16570 v8::kExternalIntArray,
16571 INT_MIN, INT_MAX);
16572 }
16573
16574
16575 THREADED_TEST(FixedFloat32Array) {
16576 FixedTypedArrayTestHelper<i::FixedFloat32Array, i::FLOAT32_ELEMENTS, float>(
16577 v8::kExternalFloatArray,
16578 -500, 500);
16579 }
16580
16581
16582 THREADED_TEST(FixedFloat64Array) {
16583 FixedTypedArrayTestHelper<i::FixedFloat64Array, i::FLOAT64_ELEMENTS, float>(
16584 v8::kExternalDoubleArray,
16585 -500, 500);
16586 }
16587
16588
16401 template <class ExternalArrayClass, class ElementType> 16589 template <class ExternalArrayClass, class ElementType>
16402 static void ExternalArrayTestHelper(v8::ExternalArrayType array_type, 16590 static void ExternalArrayTestHelper(v8::ExternalArrayType array_type,
16403 int64_t low, 16591 int64_t low,
16404 int64_t high) { 16592 int64_t high) {
16405 LocalContext context; 16593 LocalContext context;
16406 i::Isolate* isolate = CcTest::i_isolate(); 16594 i::Isolate* isolate = CcTest::i_isolate();
16407 i::Factory* factory = isolate->factory(); 16595 i::Factory* factory = isolate->factory();
16408 v8::HandleScope scope(context->GetIsolate()); 16596 v8::HandleScope scope(context->GetIsolate());
16409 const int kElementCount = 40; 16597 const int kElementCount = 40;
16410 int element_size = ExternalArrayElementSize(array_type); 16598 int element_size = ExternalArrayElementSize(array_type);
(...skipping 5209 matching lines...) Expand 10 before | Expand all | Expand 10 after
21620 } 21808 }
21621 for (int i = 0; i < runs; i++) { 21809 for (int i = 0; i < runs; i++) {
21622 Local<String> expected; 21810 Local<String> expected;
21623 if (i != 0) { 21811 if (i != 0) {
21624 CHECK_EQ(v8_str("escape value"), values[i]); 21812 CHECK_EQ(v8_str("escape value"), values[i]);
21625 } else { 21813 } else {
21626 CHECK(values[i].IsEmpty()); 21814 CHECK(values[i].IsEmpty());
21627 } 21815 }
21628 } 21816 }
21629 } 21817 }
21818
21819
21820 static void SetterWhichExpectsThisAndHolderToDiffer(
21821 Local<String>, Local<Value>, const v8::PropertyCallbackInfo<void>& info) {
21822 CHECK(info.Holder() != info.This());
21823 }
21824
21825
21826 TEST(Regress239669) {
21827 LocalContext context;
21828 v8::Isolate* isolate = context->GetIsolate();
21829 v8::HandleScope scope(isolate);
21830 Local<ObjectTemplate> templ = ObjectTemplate::New(isolate);
21831 templ->SetAccessor(v8_str("x"), 0, SetterWhichExpectsThisAndHolderToDiffer);
21832 context->Global()->Set(v8_str("P"), templ->NewInstance());
21833 CompileRun(
21834 "function C1() {"
21835 " this.x = 23;"
21836 "};"
21837 "C1.prototype = P;"
21838 "for (var i = 0; i < 4; i++ ) {"
21839 " new C1();"
21840 "}");
21841 }
OLDNEW
« no previous file with comments | « test/cctest/profiler-extension.cc ('k') | test/cctest/test-ast.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698