| 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 15658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15669 result = CompileRun("var sum = 0;" | 15669 result = CompileRun("var sum = 0;" |
| 15670 "for (var i = 0; i < 8; i++) {" | 15670 "for (var i = 0; i < 8; i++) {" |
| 15671 " sum += pixels[i];" | 15671 " sum += pixels[i];" |
| 15672 "}" | 15672 "}" |
| 15673 "sum;"); | 15673 "sum;"); |
| 15674 CHECK_EQ(28, result->Int32Value()); | 15674 CHECK_EQ(28, result->Int32Value()); |
| 15675 | 15675 |
| 15676 i::Handle<i::Smi> value(i::Smi::FromInt(2), | 15676 i::Handle<i::Smi> value(i::Smi::FromInt(2), |
| 15677 reinterpret_cast<i::Isolate*>(context->GetIsolate())); | 15677 reinterpret_cast<i::Isolate*>(context->GetIsolate())); |
| 15678 i::Handle<i::Object> no_failure; | 15678 i::Handle<i::Object> no_failure; |
| 15679 no_failure = | 15679 no_failure = i::JSObject::SetElement(jsobj, 1, value, NONE, i::SLOPPY); |
| 15680 i::JSObject::SetElement(jsobj, 1, value, NONE, i::kSloppyMode); | |
| 15681 ASSERT(!no_failure.is_null()); | 15680 ASSERT(!no_failure.is_null()); |
| 15682 i::USE(no_failure); | 15681 i::USE(no_failure); |
| 15683 CheckElementValue(isolate, 2, jsobj, 1); | 15682 CheckElementValue(isolate, 2, jsobj, 1); |
| 15684 *value.location() = i::Smi::FromInt(256); | 15683 *value.location() = i::Smi::FromInt(256); |
| 15685 no_failure = | 15684 no_failure = i::JSObject::SetElement(jsobj, 1, value, NONE, i::SLOPPY); |
| 15686 i::JSObject::SetElement(jsobj, 1, value, NONE, i::kSloppyMode); | |
| 15687 ASSERT(!no_failure.is_null()); | 15685 ASSERT(!no_failure.is_null()); |
| 15688 i::USE(no_failure); | 15686 i::USE(no_failure); |
| 15689 CheckElementValue(isolate, 255, jsobj, 1); | 15687 CheckElementValue(isolate, 255, jsobj, 1); |
| 15690 *value.location() = i::Smi::FromInt(-1); | 15688 *value.location() = i::Smi::FromInt(-1); |
| 15691 no_failure = | 15689 no_failure = i::JSObject::SetElement(jsobj, 1, value, NONE, i::SLOPPY); |
| 15692 i::JSObject::SetElement(jsobj, 1, value, NONE, i::kSloppyMode); | |
| 15693 ASSERT(!no_failure.is_null()); | 15690 ASSERT(!no_failure.is_null()); |
| 15694 i::USE(no_failure); | 15691 i::USE(no_failure); |
| 15695 CheckElementValue(isolate, 0, jsobj, 1); | 15692 CheckElementValue(isolate, 0, jsobj, 1); |
| 15696 | 15693 |
| 15697 result = CompileRun("for (var i = 0; i < 8; i++) {" | 15694 result = CompileRun("for (var i = 0; i < 8; i++) {" |
| 15698 " pixels[i] = (i * 65) - 109;" | 15695 " pixels[i] = (i * 65) - 109;" |
| 15699 "}" | 15696 "}" |
| 15700 "pixels[1] + pixels[6];"); | 15697 "pixels[1] + pixels[6];"); |
| 15701 CHECK_EQ(255, result->Int32Value()); | 15698 CHECK_EQ(255, result->Int32Value()); |
| 15702 CheckElementValue(isolate, 0, jsobj, 0); | 15699 CheckElementValue(isolate, 0, jsobj, 0); |
| (...skipping 6403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 22106 Local<Object> ApiCallOptimizationChecker::holder; | 22103 Local<Object> ApiCallOptimizationChecker::holder; |
| 22107 Local<Object> ApiCallOptimizationChecker::callee; | 22104 Local<Object> ApiCallOptimizationChecker::callee; |
| 22108 int ApiCallOptimizationChecker::count = 0; | 22105 int ApiCallOptimizationChecker::count = 0; |
| 22109 | 22106 |
| 22110 | 22107 |
| 22111 TEST(TestFunctionCallOptimization) { | 22108 TEST(TestFunctionCallOptimization) { |
| 22112 i::FLAG_allow_natives_syntax = true; | 22109 i::FLAG_allow_natives_syntax = true; |
| 22113 ApiCallOptimizationChecker checker; | 22110 ApiCallOptimizationChecker checker; |
| 22114 checker.RunAll(); | 22111 checker.RunAll(); |
| 22115 } | 22112 } |
| OLD | NEW |