| OLD | NEW |
| 1 // Copyright 2007-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2007-2009 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 9260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9271 } | 9271 } |
| 9272 two_byte_content_[14] = 'b'; | 9272 two_byte_content_[14] = 'b'; |
| 9273 | 9273 |
| 9274 // Create the input string for the regexp - the one we are going to change | 9274 // Create the input string for the regexp - the one we are going to change |
| 9275 // properties of. | 9275 // properties of. |
| 9276 input_ = i::Factory::NewExternalStringFromAscii(&ascii_resource_); | 9276 input_ = i::Factory::NewExternalStringFromAscii(&ascii_resource_); |
| 9277 | 9277 |
| 9278 // Inject the input as a global variable. | 9278 // Inject the input as a global variable. |
| 9279 i::Handle<i::String> input_name = | 9279 i::Handle<i::String> input_name = |
| 9280 i::Factory::NewStringFromAscii(i::Vector<const char>("input", 5)); | 9280 i::Factory::NewStringFromAscii(i::Vector<const char>("input", 5)); |
| 9281 i::Top::global_context()->global()->SetProperty(*input_name, *input_, NONE); | 9281 i::Top::global_context()->global()->SetProperty(*input_name, |
| 9282 *input_, |
| 9283 NONE)->ToObjectChecked(); |
| 9282 | 9284 |
| 9283 | 9285 |
| 9284 MorphThread morph_thread(this); | 9286 MorphThread morph_thread(this); |
| 9285 morph_thread.Start(); | 9287 morph_thread.Start(); |
| 9286 v8::Locker::StartPreemption(1); | 9288 v8::Locker::StartPreemption(1); |
| 9287 LongRunningRegExp(); | 9289 LongRunningRegExp(); |
| 9288 { | 9290 { |
| 9289 v8::Unlocker unlock; | 9291 v8::Unlocker unlock; |
| 9290 morph_thread.Join(); | 9292 morph_thread.Join(); |
| 9291 } | 9293 } |
| (...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9743 for (int i = 0; i < kElementCount; i++) { | 9745 for (int i = 0; i < kElementCount; i++) { |
| 9744 CHECK_EQ(i % 256, pixels->get(i)); | 9746 CHECK_EQ(i % 256, pixels->get(i)); |
| 9745 CHECK_EQ(i % 256, pixel_data[i]); | 9747 CHECK_EQ(i % 256, pixel_data[i]); |
| 9746 } | 9748 } |
| 9747 | 9749 |
| 9748 v8::Handle<v8::Object> obj = v8::Object::New(); | 9750 v8::Handle<v8::Object> obj = v8::Object::New(); |
| 9749 i::Handle<i::JSObject> jsobj = v8::Utils::OpenHandle(*obj); | 9751 i::Handle<i::JSObject> jsobj = v8::Utils::OpenHandle(*obj); |
| 9750 // Set the elements to be the pixels. | 9752 // Set the elements to be the pixels. |
| 9751 // jsobj->set_elements(*pixels); | 9753 // jsobj->set_elements(*pixels); |
| 9752 obj->SetIndexedPropertiesToPixelData(pixel_data, kElementCount); | 9754 obj->SetIndexedPropertiesToPixelData(pixel_data, kElementCount); |
| 9753 CHECK_EQ(1, i::Smi::cast(jsobj->GetElement(1))->value()); | 9755 CHECK_EQ(1, i::Smi::cast(jsobj->GetElement(1)->ToObjectChecked())->value()); |
| 9754 obj->Set(v8_str("field"), v8::Int32::New(1503)); | 9756 obj->Set(v8_str("field"), v8::Int32::New(1503)); |
| 9755 context->Global()->Set(v8_str("pixels"), obj); | 9757 context->Global()->Set(v8_str("pixels"), obj); |
| 9756 v8::Handle<v8::Value> result = CompileRun("pixels.field"); | 9758 v8::Handle<v8::Value> result = CompileRun("pixels.field"); |
| 9757 CHECK_EQ(1503, result->Int32Value()); | 9759 CHECK_EQ(1503, result->Int32Value()); |
| 9758 result = CompileRun("pixels[1]"); | 9760 result = CompileRun("pixels[1]"); |
| 9759 CHECK_EQ(1, result->Int32Value()); | 9761 CHECK_EQ(1, result->Int32Value()); |
| 9760 | 9762 |
| 9761 result = CompileRun("var sum = 0;" | 9763 result = CompileRun("var sum = 0;" |
| 9762 "for (var i = 0; i < 8; i++) {" | 9764 "for (var i = 0; i < 8; i++) {" |
| 9763 " sum += pixels[i] = pixels[i] = -i;" | 9765 " sum += pixels[i] = pixels[i] = -i;" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9795 | 9797 |
| 9796 result = CompileRun("var sum = 0;" | 9798 result = CompileRun("var sum = 0;" |
| 9797 "for (var i = 0; i < 8; i++) {" | 9799 "for (var i = 0; i < 8; i++) {" |
| 9798 " sum += pixels[i];" | 9800 " sum += pixels[i];" |
| 9799 "}" | 9801 "}" |
| 9800 "sum;"); | 9802 "sum;"); |
| 9801 CHECK_EQ(28, result->Int32Value()); | 9803 CHECK_EQ(28, result->Int32Value()); |
| 9802 | 9804 |
| 9803 i::Handle<i::Smi> value(i::Smi::FromInt(2)); | 9805 i::Handle<i::Smi> value(i::Smi::FromInt(2)); |
| 9804 i::SetElement(jsobj, 1, value); | 9806 i::SetElement(jsobj, 1, value); |
| 9805 CHECK_EQ(2, i::Smi::cast(jsobj->GetElement(1))->value()); | 9807 CHECK_EQ(2, i::Smi::cast(jsobj->GetElement(1)->ToObjectChecked())->value()); |
| 9806 *value.location() = i::Smi::FromInt(256); | 9808 *value.location() = i::Smi::FromInt(256); |
| 9807 i::SetElement(jsobj, 1, value); | 9809 i::SetElement(jsobj, 1, value); |
| 9808 CHECK_EQ(255, i::Smi::cast(jsobj->GetElement(1))->value()); | 9810 CHECK_EQ(255, |
| 9811 i::Smi::cast(jsobj->GetElement(1)->ToObjectChecked())->value()); |
| 9809 *value.location() = i::Smi::FromInt(-1); | 9812 *value.location() = i::Smi::FromInt(-1); |
| 9810 i::SetElement(jsobj, 1, value); | 9813 i::SetElement(jsobj, 1, value); |
| 9811 CHECK_EQ(0, i::Smi::cast(jsobj->GetElement(1))->value()); | 9814 CHECK_EQ(0, i::Smi::cast(jsobj->GetElement(1)->ToObjectChecked())->value()); |
| 9812 | 9815 |
| 9813 result = CompileRun("for (var i = 0; i < 8; i++) {" | 9816 result = CompileRun("for (var i = 0; i < 8; i++) {" |
| 9814 " pixels[i] = (i * 65) - 109;" | 9817 " pixels[i] = (i * 65) - 109;" |
| 9815 "}" | 9818 "}" |
| 9816 "pixels[1] + pixels[6];"); | 9819 "pixels[1] + pixels[6];"); |
| 9817 CHECK_EQ(255, result->Int32Value()); | 9820 CHECK_EQ(255, result->Int32Value()); |
| 9818 CHECK_EQ(0, i::Smi::cast(jsobj->GetElement(0))->value()); | 9821 CHECK_EQ(0, i::Smi::cast(jsobj->GetElement(0)->ToObjectChecked())->value()); |
| 9819 CHECK_EQ(0, i::Smi::cast(jsobj->GetElement(1))->value()); | 9822 CHECK_EQ(0, i::Smi::cast(jsobj->GetElement(1)->ToObjectChecked())->value()); |
| 9820 CHECK_EQ(21, i::Smi::cast(jsobj->GetElement(2))->value()); | 9823 CHECK_EQ(21, |
| 9821 CHECK_EQ(86, i::Smi::cast(jsobj->GetElement(3))->value()); | 9824 i::Smi::cast(jsobj->GetElement(2)->ToObjectChecked())->value()); |
| 9822 CHECK_EQ(151, i::Smi::cast(jsobj->GetElement(4))->value()); | 9825 CHECK_EQ(86, |
| 9823 CHECK_EQ(216, i::Smi::cast(jsobj->GetElement(5))->value()); | 9826 i::Smi::cast(jsobj->GetElement(3)->ToObjectChecked())->value()); |
| 9824 CHECK_EQ(255, i::Smi::cast(jsobj->GetElement(6))->value()); | 9827 CHECK_EQ(151, |
| 9825 CHECK_EQ(255, i::Smi::cast(jsobj->GetElement(7))->value()); | 9828 i::Smi::cast(jsobj->GetElement(4)->ToObjectChecked())->value()); |
| 9829 CHECK_EQ(216, |
| 9830 i::Smi::cast(jsobj->GetElement(5)->ToObjectChecked())->value()); |
| 9831 CHECK_EQ(255, |
| 9832 i::Smi::cast(jsobj->GetElement(6)->ToObjectChecked())->value()); |
| 9833 CHECK_EQ(255, |
| 9834 i::Smi::cast(jsobj->GetElement(7)->ToObjectChecked())->value()); |
| 9826 result = CompileRun("var sum = 0;" | 9835 result = CompileRun("var sum = 0;" |
| 9827 "for (var i = 0; i < 8; i++) {" | 9836 "for (var i = 0; i < 8; i++) {" |
| 9828 " sum += pixels[i];" | 9837 " sum += pixels[i];" |
| 9829 "}" | 9838 "}" |
| 9830 "sum;"); | 9839 "sum;"); |
| 9831 CHECK_EQ(984, result->Int32Value()); | 9840 CHECK_EQ(984, result->Int32Value()); |
| 9832 | 9841 |
| 9833 result = CompileRun("for (var i = 0; i < 8; i++) {" | 9842 result = CompileRun("for (var i = 0; i < 8; i++) {" |
| 9834 " pixels[i] = (i * 1.1);" | 9843 " pixels[i] = (i * 1.1);" |
| 9835 "}" | 9844 "}" |
| 9836 "pixels[1] + pixels[6];"); | 9845 "pixels[1] + pixels[6];"); |
| 9837 CHECK_EQ(8, result->Int32Value()); | 9846 CHECK_EQ(8, result->Int32Value()); |
| 9838 CHECK_EQ(0, i::Smi::cast(jsobj->GetElement(0))->value()); | 9847 CHECK_EQ(0, i::Smi::cast(jsobj->GetElement(0)->ToObjectChecked())->value()); |
| 9839 CHECK_EQ(1, i::Smi::cast(jsobj->GetElement(1))->value()); | 9848 CHECK_EQ(1, i::Smi::cast(jsobj->GetElement(1)->ToObjectChecked())->value()); |
| 9840 CHECK_EQ(2, i::Smi::cast(jsobj->GetElement(2))->value()); | 9849 CHECK_EQ(2, i::Smi::cast(jsobj->GetElement(2)->ToObjectChecked())->value()); |
| 9841 CHECK_EQ(3, i::Smi::cast(jsobj->GetElement(3))->value()); | 9850 CHECK_EQ(3, i::Smi::cast(jsobj->GetElement(3)->ToObjectChecked())->value()); |
| 9842 CHECK_EQ(4, i::Smi::cast(jsobj->GetElement(4))->value()); | 9851 CHECK_EQ(4, i::Smi::cast(jsobj->GetElement(4)->ToObjectChecked())->value()); |
| 9843 CHECK_EQ(6, i::Smi::cast(jsobj->GetElement(5))->value()); | 9852 CHECK_EQ(6, i::Smi::cast(jsobj->GetElement(5)->ToObjectChecked())->value()); |
| 9844 CHECK_EQ(7, i::Smi::cast(jsobj->GetElement(6))->value()); | 9853 CHECK_EQ(7, i::Smi::cast(jsobj->GetElement(6)->ToObjectChecked())->value()); |
| 9845 CHECK_EQ(8, i::Smi::cast(jsobj->GetElement(7))->value()); | 9854 CHECK_EQ(8, i::Smi::cast(jsobj->GetElement(7)->ToObjectChecked())->value()); |
| 9846 | 9855 |
| 9847 result = CompileRun("for (var i = 0; i < 8; i++) {" | 9856 result = CompileRun("for (var i = 0; i < 8; i++) {" |
| 9848 " pixels[7] = undefined;" | 9857 " pixels[7] = undefined;" |
| 9849 "}" | 9858 "}" |
| 9850 "pixels[7];"); | 9859 "pixels[7];"); |
| 9851 CHECK_EQ(0, result->Int32Value()); | 9860 CHECK_EQ(0, result->Int32Value()); |
| 9852 CHECK_EQ(0, i::Smi::cast(jsobj->GetElement(7))->value()); | 9861 CHECK_EQ(0, i::Smi::cast(jsobj->GetElement(7)->ToObjectChecked())->value()); |
| 9853 | 9862 |
| 9854 result = CompileRun("for (var i = 0; i < 8; i++) {" | 9863 result = CompileRun("for (var i = 0; i < 8; i++) {" |
| 9855 " pixels[6] = '2.3';" | 9864 " pixels[6] = '2.3';" |
| 9856 "}" | 9865 "}" |
| 9857 "pixels[6];"); | 9866 "pixels[6];"); |
| 9858 CHECK_EQ(2, result->Int32Value()); | 9867 CHECK_EQ(2, result->Int32Value()); |
| 9859 CHECK_EQ(2, i::Smi::cast(jsobj->GetElement(6))->value()); | 9868 CHECK_EQ(2, i::Smi::cast(jsobj->GetElement(6)->ToObjectChecked())->value()); |
| 9860 | 9869 |
| 9861 result = CompileRun("for (var i = 0; i < 8; i++) {" | 9870 result = CompileRun("for (var i = 0; i < 8; i++) {" |
| 9862 " pixels[5] = NaN;" | 9871 " pixels[5] = NaN;" |
| 9863 "}" | 9872 "}" |
| 9864 "pixels[5];"); | 9873 "pixels[5];"); |
| 9865 CHECK_EQ(0, result->Int32Value()); | 9874 CHECK_EQ(0, result->Int32Value()); |
| 9866 CHECK_EQ(0, i::Smi::cast(jsobj->GetElement(5))->value()); | 9875 CHECK_EQ(0, i::Smi::cast(jsobj->GetElement(5)->ToObjectChecked())->value()); |
| 9867 | 9876 |
| 9868 result = CompileRun("for (var i = 0; i < 8; i++) {" | 9877 result = CompileRun("for (var i = 0; i < 8; i++) {" |
| 9869 " pixels[8] = Infinity;" | 9878 " pixels[8] = Infinity;" |
| 9870 "}" | 9879 "}" |
| 9871 "pixels[8];"); | 9880 "pixels[8];"); |
| 9872 CHECK_EQ(255, result->Int32Value()); | 9881 CHECK_EQ(255, result->Int32Value()); |
| 9873 CHECK_EQ(255, i::Smi::cast(jsobj->GetElement(8))->value()); | 9882 CHECK_EQ(255, |
| 9883 i::Smi::cast(jsobj->GetElement(8)->ToObjectChecked())->value()); |
| 9874 | 9884 |
| 9875 result = CompileRun("for (var i = 0; i < 8; i++) {" | 9885 result = CompileRun("for (var i = 0; i < 8; i++) {" |
| 9876 " pixels[9] = -Infinity;" | 9886 " pixels[9] = -Infinity;" |
| 9877 "}" | 9887 "}" |
| 9878 "pixels[9];"); | 9888 "pixels[9];"); |
| 9879 CHECK_EQ(0, result->Int32Value()); | 9889 CHECK_EQ(0, result->Int32Value()); |
| 9880 CHECK_EQ(0, i::Smi::cast(jsobj->GetElement(9))->value()); | 9890 CHECK_EQ(0, i::Smi::cast(jsobj->GetElement(9)->ToObjectChecked())->value()); |
| 9881 | 9891 |
| 9882 result = CompileRun("pixels[3] = 33;" | 9892 result = CompileRun("pixels[3] = 33;" |
| 9883 "delete pixels[3];" | 9893 "delete pixels[3];" |
| 9884 "pixels[3];"); | 9894 "pixels[3];"); |
| 9885 CHECK_EQ(33, result->Int32Value()); | 9895 CHECK_EQ(33, result->Int32Value()); |
| 9886 | 9896 |
| 9887 result = CompileRun("pixels[0] = 10; pixels[1] = 11;" | 9897 result = CompileRun("pixels[0] = 10; pixels[1] = 11;" |
| 9888 "pixels[2] = 12; pixels[3] = 13;" | 9898 "pixels[2] = 12; pixels[3] = 13;" |
| 9889 "pixels.__defineGetter__('2'," | 9899 "pixels.__defineGetter__('2'," |
| 9890 "function() { return 120; });" | 9900 "function() { return 120; });" |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9980 CHECK_EQ(static_cast<int64_t>(i), static_cast<int64_t>(array->get(i))); | 9990 CHECK_EQ(static_cast<int64_t>(i), static_cast<int64_t>(array->get(i))); |
| 9981 CHECK_EQ(static_cast<int64_t>(i), static_cast<int64_t>(array_data[i])); | 9991 CHECK_EQ(static_cast<int64_t>(i), static_cast<int64_t>(array_data[i])); |
| 9982 } | 9992 } |
| 9983 | 9993 |
| 9984 v8::Handle<v8::Object> obj = v8::Object::New(); | 9994 v8::Handle<v8::Object> obj = v8::Object::New(); |
| 9985 i::Handle<i::JSObject> jsobj = v8::Utils::OpenHandle(*obj); | 9995 i::Handle<i::JSObject> jsobj = v8::Utils::OpenHandle(*obj); |
| 9986 // Set the elements to be the external array. | 9996 // Set the elements to be the external array. |
| 9987 obj->SetIndexedPropertiesToExternalArrayData(array_data, | 9997 obj->SetIndexedPropertiesToExternalArrayData(array_data, |
| 9988 array_type, | 9998 array_type, |
| 9989 kElementCount); | 9999 kElementCount); |
| 9990 CHECK_EQ(1, static_cast<int>(jsobj->GetElement(1)->Number())); | 10000 CHECK_EQ( |
| 10001 1, static_cast<int>(jsobj->GetElement(1)->ToObjectChecked()->Number())); |
| 9991 obj->Set(v8_str("field"), v8::Int32::New(1503)); | 10002 obj->Set(v8_str("field"), v8::Int32::New(1503)); |
| 9992 context->Global()->Set(v8_str("ext_array"), obj); | 10003 context->Global()->Set(v8_str("ext_array"), obj); |
| 9993 v8::Handle<v8::Value> result = CompileRun("ext_array.field"); | 10004 v8::Handle<v8::Value> result = CompileRun("ext_array.field"); |
| 9994 CHECK_EQ(1503, result->Int32Value()); | 10005 CHECK_EQ(1503, result->Int32Value()); |
| 9995 result = CompileRun("ext_array[1]"); | 10006 result = CompileRun("ext_array[1]"); |
| 9996 CHECK_EQ(1, result->Int32Value()); | 10007 CHECK_EQ(1, result->Int32Value()); |
| 9997 | 10008 |
| 9998 // Check pass through of assigned smis | 10009 // Check pass through of assigned smis |
| 9999 result = CompileRun("var sum = 0;" | 10010 result = CompileRun("var sum = 0;" |
| 10000 "for (var i = 0; i < 8; i++) {" | 10011 "for (var i = 0; i < 8; i++) {" |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10119 kElementCount); | 10130 kElementCount); |
| 10120 result = CompileRun(test_buf.start()); | 10131 result = CompileRun(test_buf.start()); |
| 10121 CHECK_EQ(false, result->BooleanValue()); | 10132 CHECK_EQ(false, result->BooleanValue()); |
| 10122 | 10133 |
| 10123 // Check other boundary conditions, values and operations. | 10134 // Check other boundary conditions, values and operations. |
| 10124 result = CompileRun("for (var i = 0; i < 8; i++) {" | 10135 result = CompileRun("for (var i = 0; i < 8; i++) {" |
| 10125 " ext_array[7] = undefined;" | 10136 " ext_array[7] = undefined;" |
| 10126 "}" | 10137 "}" |
| 10127 "ext_array[7];"); | 10138 "ext_array[7];"); |
| 10128 CHECK_EQ(0, result->Int32Value()); | 10139 CHECK_EQ(0, result->Int32Value()); |
| 10129 CHECK_EQ(0, static_cast<int>(jsobj->GetElement(7)->Number())); | 10140 CHECK_EQ( |
| 10141 0, static_cast<int>(jsobj->GetElement(7)->ToObjectChecked()->Number())); |
| 10130 | 10142 |
| 10131 result = CompileRun("for (var i = 0; i < 8; i++) {" | 10143 result = CompileRun("for (var i = 0; i < 8; i++) {" |
| 10132 " ext_array[6] = '2.3';" | 10144 " ext_array[6] = '2.3';" |
| 10133 "}" | 10145 "}" |
| 10134 "ext_array[6];"); | 10146 "ext_array[6];"); |
| 10135 CHECK_EQ(2, result->Int32Value()); | 10147 CHECK_EQ(2, result->Int32Value()); |
| 10136 CHECK_EQ(2, static_cast<int>(jsobj->GetElement(6)->Number())); | 10148 CHECK_EQ( |
| 10149 2, static_cast<int>(jsobj->GetElement(6)->ToObjectChecked()->Number())); |
| 10137 | 10150 |
| 10138 if (array_type != v8::kExternalFloatArray) { | 10151 if (array_type != v8::kExternalFloatArray) { |
| 10139 // Though the specification doesn't state it, be explicit about | 10152 // Though the specification doesn't state it, be explicit about |
| 10140 // converting NaNs and +/-Infinity to zero. | 10153 // converting NaNs and +/-Infinity to zero. |
| 10141 result = CompileRun("for (var i = 0; i < 8; i++) {" | 10154 result = CompileRun("for (var i = 0; i < 8; i++) {" |
| 10142 " ext_array[i] = 5;" | 10155 " ext_array[i] = 5;" |
| 10143 "}" | 10156 "}" |
| 10144 "for (var i = 0; i < 8; i++) {" | 10157 "for (var i = 0; i < 8; i++) {" |
| 10145 " ext_array[i] = NaN;" | 10158 " ext_array[i] = NaN;" |
| 10146 "}" | 10159 "}" |
| 10147 "ext_array[5];"); | 10160 "ext_array[5];"); |
| 10148 CHECK_EQ(0, result->Int32Value()); | 10161 CHECK_EQ(0, result->Int32Value()); |
| 10149 CHECK_EQ(0, i::Smi::cast(jsobj->GetElement(5))->value()); | 10162 CHECK_EQ(0, |
| 10163 i::Smi::cast(jsobj->GetElement(5)->ToObjectChecked())->value()); |
| 10150 | 10164 |
| 10151 result = CompileRun("for (var i = 0; i < 8; i++) {" | 10165 result = CompileRun("for (var i = 0; i < 8; i++) {" |
| 10152 " ext_array[i] = 5;" | 10166 " ext_array[i] = 5;" |
| 10153 "}" | 10167 "}" |
| 10154 "for (var i = 0; i < 8; i++) {" | 10168 "for (var i = 0; i < 8; i++) {" |
| 10155 " ext_array[i] = Infinity;" | 10169 " ext_array[i] = Infinity;" |
| 10156 "}" | 10170 "}" |
| 10157 "ext_array[5];"); | 10171 "ext_array[5];"); |
| 10158 CHECK_EQ(0, result->Int32Value()); | 10172 CHECK_EQ(0, result->Int32Value()); |
| 10159 CHECK_EQ(0, i::Smi::cast(jsobj->GetElement(5))->value()); | 10173 CHECK_EQ(0, |
| 10174 i::Smi::cast(jsobj->GetElement(5)->ToObjectChecked())->value()); |
| 10160 | 10175 |
| 10161 result = CompileRun("for (var i = 0; i < 8; i++) {" | 10176 result = CompileRun("for (var i = 0; i < 8; i++) {" |
| 10162 " ext_array[i] = 5;" | 10177 " ext_array[i] = 5;" |
| 10163 "}" | 10178 "}" |
| 10164 "for (var i = 0; i < 8; i++) {" | 10179 "for (var i = 0; i < 8; i++) {" |
| 10165 " ext_array[i] = -Infinity;" | 10180 " ext_array[i] = -Infinity;" |
| 10166 "}" | 10181 "}" |
| 10167 "ext_array[5];"); | 10182 "ext_array[5];"); |
| 10168 CHECK_EQ(0, result->Int32Value()); | 10183 CHECK_EQ(0, result->Int32Value()); |
| 10169 CHECK_EQ(0, i::Smi::cast(jsobj->GetElement(5))->value()); | 10184 CHECK_EQ(0, |
| 10185 i::Smi::cast(jsobj->GetElement(5)->ToObjectChecked())->value()); |
| 10170 } | 10186 } |
| 10171 | 10187 |
| 10172 result = CompileRun("ext_array[3] = 33;" | 10188 result = CompileRun("ext_array[3] = 33;" |
| 10173 "delete ext_array[3];" | 10189 "delete ext_array[3];" |
| 10174 "ext_array[3];"); | 10190 "ext_array[3];"); |
| 10175 CHECK_EQ(33, result->Int32Value()); | 10191 CHECK_EQ(33, result->Int32Value()); |
| 10176 | 10192 |
| 10177 result = CompileRun("ext_array[0] = 10; ext_array[1] = 11;" | 10193 result = CompileRun("ext_array[0] = 10; ext_array[1] = 11;" |
| 10178 "ext_array[2] = 12; ext_array[3] = 13;" | 10194 "ext_array[2] = 12; ext_array[3] = 13;" |
| 10179 "ext_array.__defineGetter__('2'," | 10195 "ext_array.__defineGetter__('2'," |
| (...skipping 1568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11748 v8::Context::Scope context_scope(context.local()); | 11764 v8::Context::Scope context_scope(context.local()); |
| 11749 | 11765 |
| 11750 v8::Handle<v8::ObjectTemplate> tmpl = v8::ObjectTemplate::New(); | 11766 v8::Handle<v8::ObjectTemplate> tmpl = v8::ObjectTemplate::New(); |
| 11751 tmpl->SetNamedPropertyHandler(Getter, NULL, NULL, NULL, Enumerator); | 11767 tmpl->SetNamedPropertyHandler(Getter, NULL, NULL, NULL, Enumerator); |
| 11752 context->Global()->Set(v8_str("o"), tmpl->NewInstance()); | 11768 context->Global()->Set(v8_str("o"), tmpl->NewInstance()); |
| 11753 v8::Handle<v8::Array> result = v8::Handle<v8::Array>::Cast(CompileRun( | 11769 v8::Handle<v8::Array> result = v8::Handle<v8::Array>::Cast(CompileRun( |
| 11754 "var result = []; for (var k in o) result.push(k); result")); | 11770 "var result = []; for (var k in o) result.push(k); result")); |
| 11755 CHECK_EQ(1, result->Length()); | 11771 CHECK_EQ(1, result->Length()); |
| 11756 CHECK_EQ(v8_str("universalAnswer"), result->Get(0)); | 11772 CHECK_EQ(v8_str("universalAnswer"), result->Get(0)); |
| 11757 } | 11773 } |
| OLD | NEW |