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 5073 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5084 HandleScope scope(isolate); | 5084 HandleScope scope(isolate); |
5085 | 5085 |
5086 MacroAssembler assm(isolate, NULL, 0, v8::internal::CodeObjectRequired::kYes); | 5086 MacroAssembler assm(isolate, NULL, 0, v8::internal::CodeObjectRequired::kYes); |
5087 | 5087 |
5088 Label continue_1, stop_execution; | 5088 Label continue_1, stop_execution; |
5089 __ push(ra); | 5089 __ push(ra); |
5090 __ li(v0, 0); | 5090 __ li(v0, 0); |
5091 __ li(t8, 0); | 5091 __ li(t8, 0); |
5092 __ li(t9, 2); // A condition for stopping execution. | 5092 __ li(t9, 2); // A condition for stopping execution. |
5093 | 5093 |
5094 uint32_t instruction_addiu = 0x24420001; // addiu v0, v0, 1 | |
5095 for (int32_t i = -100; i <= -11; ++i) { | 5094 for (int32_t i = -100; i <= -11; ++i) { |
5096 __ dd(instruction_addiu); | 5095 __ addiu(v0, v0, 1); |
5097 } | 5096 } |
5098 | 5097 |
5099 __ addiu(t8, t8, 1); // -10 | 5098 __ addiu(t8, t8, 1); // -10 |
5100 | 5099 |
5101 __ beq(t8, t9, &stop_execution); // -9 | 5100 __ beq(t8, t9, &stop_execution); // -9 |
5102 __ nop(); // -8 | 5101 __ nop(); // -8 |
5103 __ beq(t8, t8, &continue_1); // -7 | 5102 __ beq(t8, t8, &continue_1); // -7 |
5104 __ nop(); // -6 | 5103 __ nop(); // -6 |
5105 | 5104 |
5106 __ bind(&stop_execution); | 5105 __ bind(&stop_execution); |
5107 __ pop(ra); // -5, -4 | 5106 __ pop(ra); // -5, -4 |
5108 __ jr(ra); // -3 | 5107 __ jr(ra); // -3 |
5109 __ nop(); // -2 | 5108 __ nop(); // -2 |
5110 | 5109 |
5111 __ bind(&continue_1); | 5110 __ bind(&continue_1); |
5112 __ bc(offset); // -1 | 5111 __ bc(offset); // -1 |
5113 | 5112 |
5114 for (int32_t i = 0; i <= 99; ++i) { | 5113 for (int32_t i = 0; i <= 99; ++i) { |
5115 __ dd(instruction_addiu); | 5114 __ addiu(v0, v0, 1); |
5116 } | 5115 } |
5117 | 5116 |
5118 __ pop(ra); | 5117 __ pop(ra); |
5119 __ jr(ra); | 5118 __ jr(ra); |
5120 __ nop(); | 5119 __ nop(); |
5121 | 5120 |
5122 CodeDesc desc; | 5121 CodeDesc desc; |
5123 assm.GetCode(&desc); | 5122 assm.GetCode(&desc); |
5124 Handle<Code> code = isolate->factory()->NewCode( | 5123 Handle<Code> code = isolate->factory()->NewCode( |
5125 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); | 5124 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5448 Handle<Code> code = isolate->factory()->NewCode( | 5447 Handle<Code> code = isolate->factory()->NewCode( |
5449 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); | 5448 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
5450 F2 f = FUNCTION_CAST<F2>(code->entry()); | 5449 F2 f = FUNCTION_CAST<F2>(code->entry()); |
5451 | 5450 |
5452 int32_t res = reinterpret_cast<int32_t>( | 5451 int32_t res = reinterpret_cast<int32_t>( |
5453 CALL_GENERATED_CODE(isolate, f, 42, 42, 0, 0, 0)); | 5452 CALL_GENERATED_CODE(isolate, f, 42, 42, 0, 0, 0)); |
5454 CHECK_EQ(res, 0); | 5453 CHECK_EQ(res, 0); |
5455 } | 5454 } |
5456 | 5455 |
5457 #undef __ | 5456 #undef __ |
OLD | NEW |