Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: test/cctest/test-api.cc

Issue 6613005: Implementation of strict mode in SetElement. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: SetElement and strict mode. Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 10599 matching lines...) Expand 10 before | Expand all | Expand 10 after
10610 CHECK_EQ(28, result->Int32Value()); 10610 CHECK_EQ(28, result->Int32Value());
10611 10611
10612 result = CompileRun("var sum = 0;" 10612 result = CompileRun("var sum = 0;"
10613 "for (var i = 0; i < 8; i++) {" 10613 "for (var i = 0; i < 8; i++) {"
10614 " sum += pixels[i];" 10614 " sum += pixels[i];"
10615 "}" 10615 "}"
10616 "sum;"); 10616 "sum;");
10617 CHECK_EQ(28, result->Int32Value()); 10617 CHECK_EQ(28, result->Int32Value());
10618 10618
10619 i::Handle<i::Smi> value(i::Smi::FromInt(2)); 10619 i::Handle<i::Smi> value(i::Smi::FromInt(2));
10620 i::SetElement(jsobj, 1, value); 10620 i::SetElement(jsobj, 1, value, i::kNonStrictMode);
10621 CHECK_EQ(2, i::Smi::cast(jsobj->GetElement(1)->ToObjectChecked())->value()); 10621 CHECK_EQ(2, i::Smi::cast(jsobj->GetElement(1)->ToObjectChecked())->value());
10622 *value.location() = i::Smi::FromInt(256); 10622 *value.location() = i::Smi::FromInt(256);
10623 i::SetElement(jsobj, 1, value); 10623 i::SetElement(jsobj, 1, value, i::kNonStrictMode);
10624 CHECK_EQ(255, 10624 CHECK_EQ(255,
10625 i::Smi::cast(jsobj->GetElement(1)->ToObjectChecked())->value()); 10625 i::Smi::cast(jsobj->GetElement(1)->ToObjectChecked())->value());
10626 *value.location() = i::Smi::FromInt(-1); 10626 *value.location() = i::Smi::FromInt(-1);
10627 i::SetElement(jsobj, 1, value); 10627 i::SetElement(jsobj, 1, value, i::kNonStrictMode);
10628 CHECK_EQ(0, i::Smi::cast(jsobj->GetElement(1)->ToObjectChecked())->value()); 10628 CHECK_EQ(0, i::Smi::cast(jsobj->GetElement(1)->ToObjectChecked())->value());
10629 10629
10630 result = CompileRun("for (var i = 0; i < 8; i++) {" 10630 result = CompileRun("for (var i = 0; i < 8; i++) {"
10631 " pixels[i] = (i * 65) - 109;" 10631 " pixels[i] = (i * 65) - 109;"
10632 "}" 10632 "}"
10633 "pixels[1] + pixels[6];"); 10633 "pixels[1] + pixels[6];");
10634 CHECK_EQ(255, result->Int32Value()); 10634 CHECK_EQ(255, result->Int32Value());
10635 CHECK_EQ(0, i::Smi::cast(jsobj->GetElement(0)->ToObjectChecked())->value()); 10635 CHECK_EQ(0, i::Smi::cast(jsobj->GetElement(0)->ToObjectChecked())->value());
10636 CHECK_EQ(0, i::Smi::cast(jsobj->GetElement(1)->ToObjectChecked())->value()); 10636 CHECK_EQ(0, i::Smi::cast(jsobj->GetElement(1)->ToObjectChecked())->value());
10637 CHECK_EQ(21, 10637 CHECK_EQ(21,
(...skipping 2246 matching lines...) Expand 10 before | Expand all | Expand 10 after
12884 v8::Handle<v8::Function> define_property = 12884 v8::Handle<v8::Function> define_property =
12885 CompileRun("(function() {" 12885 CompileRun("(function() {"
12886 " Object.defineProperty(" 12886 " Object.defineProperty("
12887 " this," 12887 " this,"
12888 " 1," 12888 " 1,"
12889 " { configurable: true, enumerable: true, value: 3 });" 12889 " { configurable: true, enumerable: true, value: 3 });"
12890 "})").As<Function>(); 12890 "})").As<Function>();
12891 context->DetachGlobal(); 12891 context->DetachGlobal();
12892 define_property->Call(proxy, 0, NULL); 12892 define_property->Call(proxy, 0, NULL);
12893 } 12893 }
OLDNEW
« src/runtime.cc ('K') | « src/type-info.cc ('k') | test/cctest/test-heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698