| 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 15710 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15721 result = CompileRun("var sum = 0;" | 15721 result = CompileRun("var sum = 0;" |
| 15722 "for (var i = 0; i < 8; i++) {" | 15722 "for (var i = 0; i < 8; i++) {" |
| 15723 " sum += pixels[i];" | 15723 " sum += pixels[i];" |
| 15724 "}" | 15724 "}" |
| 15725 "sum;"); | 15725 "sum;"); |
| 15726 CHECK_EQ(28, result->Int32Value()); | 15726 CHECK_EQ(28, result->Int32Value()); |
| 15727 | 15727 |
| 15728 i::Handle<i::Smi> value(i::Smi::FromInt(2), | 15728 i::Handle<i::Smi> value(i::Smi::FromInt(2), |
| 15729 reinterpret_cast<i::Isolate*>(context->GetIsolate())); | 15729 reinterpret_cast<i::Isolate*>(context->GetIsolate())); |
| 15730 i::Handle<i::Object> no_failure; | 15730 i::Handle<i::Object> no_failure; |
| 15731 no_failure = i::JSObject::SetElement(jsobj, 1, value, NONE, i::SLOPPY); | 15731 no_failure = i::JSObject::SetElement( |
| 15732 jsobj, 1, value, NONE, i::SLOPPY).ToHandleChecked(); |
| 15732 ASSERT(!no_failure.is_null()); | 15733 ASSERT(!no_failure.is_null()); |
| 15733 i::USE(no_failure); | 15734 i::USE(no_failure); |
| 15734 CheckElementValue(isolate, 2, jsobj, 1); | 15735 CheckElementValue(isolate, 2, jsobj, 1); |
| 15735 *value.location() = i::Smi::FromInt(256); | 15736 *value.location() = i::Smi::FromInt(256); |
| 15736 no_failure = i::JSObject::SetElement(jsobj, 1, value, NONE, i::SLOPPY); | 15737 no_failure = i::JSObject::SetElement( |
| 15738 jsobj, 1, value, NONE, i::SLOPPY).ToHandleChecked(); |
| 15737 ASSERT(!no_failure.is_null()); | 15739 ASSERT(!no_failure.is_null()); |
| 15738 i::USE(no_failure); | 15740 i::USE(no_failure); |
| 15739 CheckElementValue(isolate, 255, jsobj, 1); | 15741 CheckElementValue(isolate, 255, jsobj, 1); |
| 15740 *value.location() = i::Smi::FromInt(-1); | 15742 *value.location() = i::Smi::FromInt(-1); |
| 15741 no_failure = i::JSObject::SetElement(jsobj, 1, value, NONE, i::SLOPPY); | 15743 no_failure = i::JSObject::SetElement( |
| 15744 jsobj, 1, value, NONE, i::SLOPPY).ToHandleChecked(); |
| 15742 ASSERT(!no_failure.is_null()); | 15745 ASSERT(!no_failure.is_null()); |
| 15743 i::USE(no_failure); | 15746 i::USE(no_failure); |
| 15744 CheckElementValue(isolate, 0, jsobj, 1); | 15747 CheckElementValue(isolate, 0, jsobj, 1); |
| 15745 | 15748 |
| 15746 result = CompileRun("for (var i = 0; i < 8; i++) {" | 15749 result = CompileRun("for (var i = 0; i < 8; i++) {" |
| 15747 " pixels[i] = (i * 65) - 109;" | 15750 " pixels[i] = (i * 65) - 109;" |
| 15748 "}" | 15751 "}" |
| 15749 "pixels[1] + pixels[6];"); | 15752 "pixels[1] + pixels[6];"); |
| 15750 CHECK_EQ(255, result->Int32Value()); | 15753 CHECK_EQ(255, result->Int32Value()); |
| 15751 CheckElementValue(isolate, 0, jsobj, 0); | 15754 CheckElementValue(isolate, 0, jsobj, 0); |
| (...skipping 6638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 22390 "f.call(friend);"); | 22393 "f.call(friend);"); |
| 22391 CHECK_EQ(2, named_access_count); | 22394 CHECK_EQ(2, named_access_count); |
| 22392 | 22395 |
| 22393 // Test access using Object.setPrototypeOf reflective method. | 22396 // Test access using Object.setPrototypeOf reflective method. |
| 22394 named_access_count = 0; | 22397 named_access_count = 0; |
| 22395 CompileRun("Object.setPrototypeOf(friend, {});"); | 22398 CompileRun("Object.setPrototypeOf(friend, {});"); |
| 22396 CHECK_EQ(1, named_access_count); | 22399 CHECK_EQ(1, named_access_count); |
| 22397 CompileRun("Object.getPrototypeOf(friend);"); | 22400 CompileRun("Object.getPrototypeOf(friend);"); |
| 22398 CHECK_EQ(2, named_access_count); | 22401 CHECK_EQ(2, named_access_count); |
| 22399 } | 22402 } |
| OLD | NEW |