| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 12251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12262 | 12262 |
| 12263 result = CompileRun("var sum = 0;" | 12263 result = CompileRun("var sum = 0;" |
| 12264 "for (var i = 0; i < 8; i++) {" | 12264 "for (var i = 0; i < 8; i++) {" |
| 12265 " sum += pixels[i];" | 12265 " sum += pixels[i];" |
| 12266 "}" | 12266 "}" |
| 12267 "sum;"); | 12267 "sum;"); |
| 12268 CHECK_EQ(28, result->Int32Value()); | 12268 CHECK_EQ(28, result->Int32Value()); |
| 12269 | 12269 |
| 12270 i::Handle<i::Smi> value(i::Smi::FromInt(2)); | 12270 i::Handle<i::Smi> value(i::Smi::FromInt(2)); |
| 12271 i::Handle<i::Object> no_failure; | 12271 i::Handle<i::Object> no_failure; |
| 12272 no_failure = i::SetElement(jsobj, 1, value, i::kNonStrictMode); | 12272 no_failure = i::JSObject::SetElement(jsobj, 1, value, i::kNonStrictMode); |
| 12273 ASSERT(!no_failure.is_null()); | 12273 ASSERT(!no_failure.is_null()); |
| 12274 i::USE(no_failure); | 12274 i::USE(no_failure); |
| 12275 CHECK_EQ(2, i::Smi::cast(jsobj->GetElement(1)->ToObjectChecked())->value()); | 12275 CHECK_EQ(2, i::Smi::cast(jsobj->GetElement(1)->ToObjectChecked())->value()); |
| 12276 *value.location() = i::Smi::FromInt(256); | 12276 *value.location() = i::Smi::FromInt(256); |
| 12277 no_failure = i::SetElement(jsobj, 1, value, i::kNonStrictMode); | 12277 no_failure = i::JSObject::SetElement(jsobj, 1, value, i::kNonStrictMode); |
| 12278 ASSERT(!no_failure.is_null()); | 12278 ASSERT(!no_failure.is_null()); |
| 12279 i::USE(no_failure); | 12279 i::USE(no_failure); |
| 12280 CHECK_EQ(255, | 12280 CHECK_EQ(255, |
| 12281 i::Smi::cast(jsobj->GetElement(1)->ToObjectChecked())->value()); | 12281 i::Smi::cast(jsobj->GetElement(1)->ToObjectChecked())->value()); |
| 12282 *value.location() = i::Smi::FromInt(-1); | 12282 *value.location() = i::Smi::FromInt(-1); |
| 12283 no_failure = i::SetElement(jsobj, 1, value, i::kNonStrictMode); | 12283 no_failure = i::JSObject::SetElement(jsobj, 1, value, i::kNonStrictMode); |
| 12284 ASSERT(!no_failure.is_null()); | 12284 ASSERT(!no_failure.is_null()); |
| 12285 i::USE(no_failure); | 12285 i::USE(no_failure); |
| 12286 CHECK_EQ(0, i::Smi::cast(jsobj->GetElement(1)->ToObjectChecked())->value()); | 12286 CHECK_EQ(0, i::Smi::cast(jsobj->GetElement(1)->ToObjectChecked())->value()); |
| 12287 | 12287 |
| 12288 result = CompileRun("for (var i = 0; i < 8; i++) {" | 12288 result = CompileRun("for (var i = 0; i < 8; i++) {" |
| 12289 " pixels[i] = (i * 65) - 109;" | 12289 " pixels[i] = (i * 65) - 109;" |
| 12290 "}" | 12290 "}" |
| 12291 "pixels[1] + pixels[6];"); | 12291 "pixels[1] + pixels[6];"); |
| 12292 CHECK_EQ(255, result->Int32Value()); | 12292 CHECK_EQ(255, result->Int32Value()); |
| 12293 CHECK_EQ(0, i::Smi::cast(jsobj->GetElement(0)->ToObjectChecked())->value()); | 12293 CHECK_EQ(0, i::Smi::cast(jsobj->GetElement(0)->ToObjectChecked())->value()); |
| (...skipping 3425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15719 CHECK(i->Equals(CompileRun("'abcbd'.replace(/b/g,func)[3]"))); | 15719 CHECK(i->Equals(CompileRun("'abcbd'.replace(/b/g,func)[3]"))); |
| 15720 | 15720 |
| 15721 // TODO(1547): Make the following also return "i". | 15721 // TODO(1547): Make the following also return "i". |
| 15722 // Calling with environment record as base. | 15722 // Calling with environment record as base. |
| 15723 TestReceiver(o, context->Global(), "func()"); | 15723 TestReceiver(o, context->Global(), "func()"); |
| 15724 // Calling with no base. | 15724 // Calling with no base. |
| 15725 TestReceiver(o, context->Global(), "(1,func)()"); | 15725 TestReceiver(o, context->Global(), "(1,func)()"); |
| 15726 | 15726 |
| 15727 foreign_context.Dispose(); | 15727 foreign_context.Dispose(); |
| 15728 } | 15728 } |
| OLD | NEW |