| 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 15668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15679 obj_clone->Set(foo_string, | 15679 obj_clone->Set(foo_string, |
| 15680 v8::String::NewFromUtf8(isolate, "Hello")); | 15680 v8::String::NewFromUtf8(isolate, "Hello")); |
| 15681 CHECK(!obj->Get(foo_string)->IsUndefined()); | 15681 CHECK(!obj->Get(foo_string)->IsUndefined()); |
| 15682 } | 15682 } |
| 15683 | 15683 |
| 15684 | 15684 |
| 15685 static void CheckElementValue(i::Isolate* isolate, | 15685 static void CheckElementValue(i::Isolate* isolate, |
| 15686 int expected, | 15686 int expected, |
| 15687 i::Handle<i::Object> obj, | 15687 i::Handle<i::Object> obj, |
| 15688 int offset) { | 15688 int offset) { |
| 15689 i::Object* element = obj->GetElement(isolate, offset)->ToObjectChecked(); | 15689 i::Object* element = *i::Object::GetElement(isolate, obj, offset); |
| 15690 CHECK_EQ(expected, i::Smi::cast(element)->value()); | 15690 CHECK_EQ(expected, i::Smi::cast(element)->value()); |
| 15691 } | 15691 } |
| 15692 | 15692 |
| 15693 | 15693 |
| 15694 THREADED_TEST(PixelArray) { | 15694 THREADED_TEST(PixelArray) { |
| 15695 LocalContext context; | 15695 LocalContext context; |
| 15696 i::Isolate* isolate = CcTest::i_isolate(); | 15696 i::Isolate* isolate = CcTest::i_isolate(); |
| 15697 i::Factory* factory = isolate->factory(); | 15697 i::Factory* factory = isolate->factory(); |
| 15698 v8::HandleScope scope(context->GetIsolate()); | 15698 v8::HandleScope scope(context->GetIsolate()); |
| 15699 const int kElementCount = 260; | 15699 const int kElementCount = 260; |
| (...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 16313 // Check other boundary conditions, values and operations. | 16313 // Check other boundary conditions, values and operations. |
| 16314 result = CompileRun("for (var i = 0; i < 8; i++) {" | 16314 result = CompileRun("for (var i = 0; i < 8; i++) {" |
| 16315 " ext_array[7] = undefined;" | 16315 " ext_array[7] = undefined;" |
| 16316 "}" | 16316 "}" |
| 16317 "ext_array[7];"); | 16317 "ext_array[7];"); |
| 16318 CHECK_EQ(0, result->Int32Value()); | 16318 CHECK_EQ(0, result->Int32Value()); |
| 16319 if (array_type == v8::kExternalFloat64Array || | 16319 if (array_type == v8::kExternalFloat64Array || |
| 16320 array_type == v8::kExternalFloat32Array) { | 16320 array_type == v8::kExternalFloat32Array) { |
| 16321 CHECK_EQ(static_cast<int>(i::OS::nan_value()), | 16321 CHECK_EQ(static_cast<int>(i::OS::nan_value()), |
| 16322 static_cast<int>( | 16322 static_cast<int>( |
| 16323 jsobj->GetElement(isolate, 7)->ToObjectChecked()->Number())); | 16323 i::Object::GetElement(isolate, jsobj, 7)->Number())); |
| 16324 } else { | 16324 } else { |
| 16325 CheckElementValue(isolate, 0, jsobj, 7); | 16325 CheckElementValue(isolate, 0, jsobj, 7); |
| 16326 } | 16326 } |
| 16327 | 16327 |
| 16328 result = CompileRun("for (var i = 0; i < 8; i++) {" | 16328 result = CompileRun("for (var i = 0; i < 8; i++) {" |
| 16329 " ext_array[6] = '2.3';" | 16329 " ext_array[6] = '2.3';" |
| 16330 "}" | 16330 "}" |
| 16331 "ext_array[6];"); | 16331 "ext_array[6];"); |
| 16332 CHECK_EQ(2, result->Int32Value()); | 16332 CHECK_EQ(2, result->Int32Value()); |
| 16333 CHECK_EQ(2, | 16333 CHECK_EQ(2, |
| 16334 static_cast<int>( | 16334 static_cast<int>( |
| 16335 jsobj->GetElement(isolate, 6)->ToObjectChecked()->Number())); | 16335 i::Object::GetElement(isolate, jsobj, 6)->Number())); |
| 16336 | 16336 |
| 16337 if (array_type != v8::kExternalFloat32Array && | 16337 if (array_type != v8::kExternalFloat32Array && |
| 16338 array_type != v8::kExternalFloat64Array) { | 16338 array_type != v8::kExternalFloat64Array) { |
| 16339 // Though the specification doesn't state it, be explicit about | 16339 // Though the specification doesn't state it, be explicit about |
| 16340 // converting NaNs and +/-Infinity to zero. | 16340 // converting NaNs and +/-Infinity to zero. |
| 16341 result = CompileRun("for (var i = 0; i < 8; i++) {" | 16341 result = CompileRun("for (var i = 0; i < 8; i++) {" |
| 16342 " ext_array[i] = 5;" | 16342 " ext_array[i] = 5;" |
| 16343 "}" | 16343 "}" |
| 16344 "for (var i = 0; i < 8; i++) {" | 16344 "for (var i = 0; i < 8; i++) {" |
| 16345 " ext_array[i] = NaN;" | 16345 " ext_array[i] = NaN;" |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 16605 } | 16605 } |
| 16606 | 16606 |
| 16607 v8::Handle<v8::Object> obj = v8::Object::New(context->GetIsolate()); | 16607 v8::Handle<v8::Object> obj = v8::Object::New(context->GetIsolate()); |
| 16608 i::Handle<i::JSObject> jsobj = v8::Utils::OpenHandle(*obj); | 16608 i::Handle<i::JSObject> jsobj = v8::Utils::OpenHandle(*obj); |
| 16609 // Set the elements to be the external array. | 16609 // Set the elements to be the external array. |
| 16610 obj->SetIndexedPropertiesToExternalArrayData(array_data, | 16610 obj->SetIndexedPropertiesToExternalArrayData(array_data, |
| 16611 array_type, | 16611 array_type, |
| 16612 kElementCount); | 16612 kElementCount); |
| 16613 CHECK_EQ(1, | 16613 CHECK_EQ(1, |
| 16614 static_cast<int>( | 16614 static_cast<int>( |
| 16615 jsobj->GetElement(isolate, 1)->ToObjectChecked()->Number())); | 16615 i::Object::GetElement(isolate, jsobj, 1)->Number())); |
| 16616 | 16616 |
| 16617 ObjectWithExternalArrayTestHelper<ExternalArrayClass, ElementType>( | 16617 ObjectWithExternalArrayTestHelper<ExternalArrayClass, ElementType>( |
| 16618 context.local(), obj, kElementCount, array_type, low, high); | 16618 context.local(), obj, kElementCount, array_type, low, high); |
| 16619 | 16619 |
| 16620 v8::Handle<v8::Value> result; | 16620 v8::Handle<v8::Value> result; |
| 16621 | 16621 |
| 16622 // Test more complex manipulations which cause eax to contain values | 16622 // Test more complex manipulations which cause eax to contain values |
| 16623 // that won't be completely overwritten by loads from the arrays. | 16623 // that won't be completely overwritten by loads from the arrays. |
| 16624 // This catches bugs in the instructions used for the KeyedLoadIC | 16624 // This catches bugs in the instructions used for the KeyedLoadIC |
| 16625 // for byte and word types. | 16625 // for byte and word types. |
| (...skipping 5703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 22329 CompileRun("x1 = x2 = 0;"); | 22329 CompileRun("x1 = x2 = 0;"); |
| 22330 r = v8::Promise::New(isolate); | 22330 r = v8::Promise::New(isolate); |
| 22331 r->Catch(f1)->Chain(f2); | 22331 r->Catch(f1)->Chain(f2); |
| 22332 r->Reject(v8::Integer::New(isolate, 3)); | 22332 r->Reject(v8::Integer::New(isolate, 3)); |
| 22333 CHECK_EQ(0, global->Get(v8_str("x1"))->Int32Value()); | 22333 CHECK_EQ(0, global->Get(v8_str("x1"))->Int32Value()); |
| 22334 CHECK_EQ(0, global->Get(v8_str("x2"))->Int32Value()); | 22334 CHECK_EQ(0, global->Get(v8_str("x2"))->Int32Value()); |
| 22335 V8::RunMicrotasks(isolate); | 22335 V8::RunMicrotasks(isolate); |
| 22336 CHECK_EQ(3, global->Get(v8_str("x1"))->Int32Value()); | 22336 CHECK_EQ(3, global->Get(v8_str("x1"))->Int32Value()); |
| 22337 CHECK_EQ(4, global->Get(v8_str("x2"))->Int32Value()); | 22337 CHECK_EQ(4, global->Get(v8_str("x2"))->Int32Value()); |
| 22338 } | 22338 } |
| OLD | NEW |