| 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 12169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12180 | 12180 |
| 12181 result = CompileRun("var sum = 0;" | 12181 result = CompileRun("var sum = 0;" |
| 12182 "for (var i = 0; i < 8; i++) {" | 12182 "for (var i = 0; i < 8; i++) {" |
| 12183 " sum += pixels[i];" | 12183 " sum += pixels[i];" |
| 12184 "}" | 12184 "}" |
| 12185 "sum;"); | 12185 "sum;"); |
| 12186 CHECK_EQ(28, result->Int32Value()); | 12186 CHECK_EQ(28, result->Int32Value()); |
| 12187 | 12187 |
| 12188 i::Handle<i::Smi> value(i::Smi::FromInt(2)); | 12188 i::Handle<i::Smi> value(i::Smi::FromInt(2)); |
| 12189 i::Handle<i::Object> no_failure; | 12189 i::Handle<i::Object> no_failure; |
| 12190 no_failure = i::SetElement(jsobj, 1, value, i::kNonStrictMode); | 12190 no_failure = i::JSObject::SetElement(jsobj, 1, value, i::kNonStrictMode); |
| 12191 ASSERT(!no_failure.is_null()); | 12191 ASSERT(!no_failure.is_null()); |
| 12192 i::USE(no_failure); | 12192 i::USE(no_failure); |
| 12193 CHECK_EQ(2, i::Smi::cast(jsobj->GetElement(1)->ToObjectChecked())->value()); | 12193 CHECK_EQ(2, i::Smi::cast(jsobj->GetElement(1)->ToObjectChecked())->value()); |
| 12194 *value.location() = i::Smi::FromInt(256); | 12194 *value.location() = i::Smi::FromInt(256); |
| 12195 no_failure = i::SetElement(jsobj, 1, value, i::kNonStrictMode); | 12195 no_failure = i::JSObject::SetElement(jsobj, 1, value, i::kNonStrictMode); |
| 12196 ASSERT(!no_failure.is_null()); | 12196 ASSERT(!no_failure.is_null()); |
| 12197 i::USE(no_failure); | 12197 i::USE(no_failure); |
| 12198 CHECK_EQ(255, | 12198 CHECK_EQ(255, |
| 12199 i::Smi::cast(jsobj->GetElement(1)->ToObjectChecked())->value()); | 12199 i::Smi::cast(jsobj->GetElement(1)->ToObjectChecked())->value()); |
| 12200 *value.location() = i::Smi::FromInt(-1); | 12200 *value.location() = i::Smi::FromInt(-1); |
| 12201 no_failure = i::SetElement(jsobj, 1, value, i::kNonStrictMode); | 12201 no_failure = i::JSObject::SetElement(jsobj, 1, value, i::kNonStrictMode); |
| 12202 ASSERT(!no_failure.is_null()); | 12202 ASSERT(!no_failure.is_null()); |
| 12203 i::USE(no_failure); | 12203 i::USE(no_failure); |
| 12204 CHECK_EQ(0, i::Smi::cast(jsobj->GetElement(1)->ToObjectChecked())->value()); | 12204 CHECK_EQ(0, i::Smi::cast(jsobj->GetElement(1)->ToObjectChecked())->value()); |
| 12205 | 12205 |
| 12206 result = CompileRun("for (var i = 0; i < 8; i++) {" | 12206 result = CompileRun("for (var i = 0; i < 8; i++) {" |
| 12207 " pixels[i] = (i * 65) - 109;" | 12207 " pixels[i] = (i * 65) - 109;" |
| 12208 "}" | 12208 "}" |
| 12209 "pixels[1] + pixels[6];"); | 12209 "pixels[1] + pixels[6];"); |
| 12210 CHECK_EQ(255, result->Int32Value()); | 12210 CHECK_EQ(255, result->Int32Value()); |
| 12211 CHECK_EQ(0, i::Smi::cast(jsobj->GetElement(0)->ToObjectChecked())->value()); | 12211 CHECK_EQ(0, i::Smi::cast(jsobj->GetElement(0)->ToObjectChecked())->value()); |
| (...skipping 3425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15637 CHECK(i->Equals(CompileRun("'abcbd'.replace(/b/g,func)[3]"))); | 15637 CHECK(i->Equals(CompileRun("'abcbd'.replace(/b/g,func)[3]"))); |
| 15638 | 15638 |
| 15639 // TODO(1547): Make the following also return "i". | 15639 // TODO(1547): Make the following also return "i". |
| 15640 // Calling with environment record as base. | 15640 // Calling with environment record as base. |
| 15641 TestReceiver(o, context->Global(), "func()"); | 15641 TestReceiver(o, context->Global(), "func()"); |
| 15642 // Calling with no base. | 15642 // Calling with no base. |
| 15643 TestReceiver(o, context->Global(), "(1,func)()"); | 15643 TestReceiver(o, context->Global(), "(1,func)()"); |
| 15644 | 15644 |
| 15645 foreign_context.Dispose(); | 15645 foreign_context.Dispose(); |
| 15646 } | 15646 } |
| OLD | NEW |