| 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 1916 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1927 EmitKeyedPropertyLoad(property); | 1927 EmitKeyedPropertyLoad(property); |
| 1928 PrepareForBailoutForId(property->LoadId(), TOS_REG); | 1928 PrepareForBailoutForId(property->LoadId(), TOS_REG); |
| 1929 break; | 1929 break; |
| 1930 } | 1930 } |
| 1931 } | 1931 } |
| 1932 | 1932 |
| 1933 Token::Value op = expr->binary_op(); | 1933 Token::Value op = expr->binary_op(); |
| 1934 __ push(r0); // Left operand goes on the stack. | 1934 __ push(r0); // Left operand goes on the stack. |
| 1935 VisitForAccumulatorValue(expr->value()); | 1935 VisitForAccumulatorValue(expr->value()); |
| 1936 | 1936 |
| 1937 OverwriteMode mode = expr->value()->ResultOverwriteAllowed() | |
| 1938 ? OVERWRITE_RIGHT | |
| 1939 : NO_OVERWRITE; | |
| 1940 SetSourcePosition(expr->position() + 1); | 1937 SetSourcePosition(expr->position() + 1); |
| 1941 AccumulatorValueContext context(this); | 1938 AccumulatorValueContext context(this); |
| 1942 if (ShouldInlineSmiCase(op)) { | 1939 if (ShouldInlineSmiCase(op)) { |
| 1943 EmitInlineSmiBinaryOp(expr->binary_operation(), | 1940 EmitInlineSmiBinaryOp(expr->binary_operation(), |
| 1944 op, | 1941 op, |
| 1945 mode, | |
| 1946 expr->target(), | 1942 expr->target(), |
| 1947 expr->value()); | 1943 expr->value()); |
| 1948 } else { | 1944 } else { |
| 1949 EmitBinaryOp(expr->binary_operation(), op, mode); | 1945 EmitBinaryOp(expr->binary_operation(), op); |
| 1950 } | 1946 } |
| 1951 | 1947 |
| 1952 // Deoptimization point in case the binary operation may have side effects. | 1948 // Deoptimization point in case the binary operation may have side effects. |
| 1953 PrepareForBailout(expr->binary_operation(), TOS_REG); | 1949 PrepareForBailout(expr->binary_operation(), TOS_REG); |
| 1954 } else { | 1950 } else { |
| 1955 VisitForAccumulatorValue(expr->value()); | 1951 VisitForAccumulatorValue(expr->value()); |
| 1956 } | 1952 } |
| 1957 | 1953 |
| 1958 // Record source position before possible IC call. | 1954 // Record source position before possible IC call. |
| 1959 SetSourcePosition(expr->position()); | 1955 SetSourcePosition(expr->position()); |
| (...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2266 void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) { | 2262 void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) { |
| 2267 SetSourcePosition(prop->position()); | 2263 SetSourcePosition(prop->position()); |
| 2268 // Call keyed load IC. It has arguments key and receiver in r0 and r1. | 2264 // Call keyed load IC. It has arguments key and receiver in r0 and r1. |
| 2269 Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Initialize(); | 2265 Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Initialize(); |
| 2270 CallIC(ic, RelocInfo::CODE_TARGET, prop->PropertyFeedbackId()); | 2266 CallIC(ic, RelocInfo::CODE_TARGET, prop->PropertyFeedbackId()); |
| 2271 } | 2267 } |
| 2272 | 2268 |
| 2273 | 2269 |
| 2274 void FullCodeGenerator::EmitInlineSmiBinaryOp(BinaryOperation* expr, | 2270 void FullCodeGenerator::EmitInlineSmiBinaryOp(BinaryOperation* expr, |
| 2275 Token::Value op, | 2271 Token::Value op, |
| 2276 OverwriteMode mode, | |
| 2277 Expression* left_expr, | 2272 Expression* left_expr, |
| 2278 Expression* right_expr) { | 2273 Expression* right_expr) { |
| 2279 Label done, smi_case, stub_call; | 2274 Label done, smi_case, stub_call; |
| 2280 | 2275 |
| 2281 Register scratch1 = r2; | 2276 Register scratch1 = r2; |
| 2282 Register scratch2 = r3; | 2277 Register scratch2 = r3; |
| 2283 | 2278 |
| 2284 // Get the arguments. | 2279 // Get the arguments. |
| 2285 Register left = r1; | 2280 Register left = r1; |
| 2286 Register right = r0; | 2281 Register right = r0; |
| 2287 __ pop(left); | 2282 __ pop(left); |
| 2288 | 2283 |
| 2289 // Perform combined smi check on both operands. | 2284 // Perform combined smi check on both operands. |
| 2290 __ orr(scratch1, left, Operand(right)); | 2285 __ orr(scratch1, left, Operand(right)); |
| 2291 STATIC_ASSERT(kSmiTag == 0); | 2286 STATIC_ASSERT(kSmiTag == 0); |
| 2292 JumpPatchSite patch_site(masm_); | 2287 JumpPatchSite patch_site(masm_); |
| 2293 patch_site.EmitJumpIfSmi(scratch1, &smi_case); | 2288 patch_site.EmitJumpIfSmi(scratch1, &smi_case); |
| 2294 | 2289 |
| 2295 __ bind(&stub_call); | 2290 __ bind(&stub_call); |
| 2296 BinaryOpStub stub(op, mode); | 2291 BinaryOpStub stub(op); |
| 2297 CallIC(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, | 2292 CallIC(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, |
| 2298 expr->BinaryOperationFeedbackId()); | 2293 expr->BinaryOperationFeedbackId()); |
| 2299 patch_site.EmitPatchInfo(); | 2294 patch_site.EmitPatchInfo(); |
| 2300 __ jmp(&done); | 2295 __ jmp(&done); |
| 2301 | 2296 |
| 2302 __ bind(&smi_case); | 2297 __ bind(&smi_case); |
| 2303 // Smi case. This code works the same way as the smi-smi case in the type | 2298 // Smi case. This code works the same way as the smi-smi case in the type |
| 2304 // recording binary operation stub, see | 2299 // recording binary operation stub, see |
| 2305 // BinaryOpStub::GenerateSmiSmiOperation for comments. | 2300 // BinaryOpStub::GenerateSmiSmiOperation for comments. |
| 2306 switch (op) { | 2301 switch (op) { |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2361 default: | 2356 default: |
| 2362 UNREACHABLE(); | 2357 UNREACHABLE(); |
| 2363 } | 2358 } |
| 2364 | 2359 |
| 2365 __ bind(&done); | 2360 __ bind(&done); |
| 2366 context()->Plug(r0); | 2361 context()->Plug(r0); |
| 2367 } | 2362 } |
| 2368 | 2363 |
| 2369 | 2364 |
| 2370 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, | 2365 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, |
| 2371 Token::Value op, | 2366 Token::Value op) { |
| 2372 OverwriteMode mode) { | |
| 2373 __ pop(r1); | 2367 __ pop(r1); |
| 2374 BinaryOpStub stub(op, mode); | 2368 BinaryOpStub stub(op); |
| 2375 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. | 2369 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. |
| 2376 CallIC(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, | 2370 CallIC(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, |
| 2377 expr->BinaryOperationFeedbackId()); | 2371 expr->BinaryOperationFeedbackId()); |
| 2378 patch_site.EmitPatchInfo(); | 2372 patch_site.EmitPatchInfo(); |
| 2379 context()->Plug(r0); | 2373 context()->Plug(r0); |
| 2380 } | 2374 } |
| 2381 | 2375 |
| 2382 | 2376 |
| 2383 void FullCodeGenerator::EmitAssignment(Expression* expr) { | 2377 void FullCodeGenerator::EmitAssignment(Expression* expr) { |
| 2384 // Invalid left-hand sides are rewritten by the parser to have a 'throw | 2378 // Invalid left-hand sides are rewritten by the parser to have a 'throw |
| (...skipping 2069 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4454 __ bind(&stub_call); | 4448 __ bind(&stub_call); |
| 4455 // Call stub. Undo operation first. | 4449 // Call stub. Undo operation first. |
| 4456 __ sub(r0, r0, Operand(Smi::FromInt(count_value))); | 4450 __ sub(r0, r0, Operand(Smi::FromInt(count_value))); |
| 4457 } | 4451 } |
| 4458 __ mov(r1, r0); | 4452 __ mov(r1, r0); |
| 4459 __ mov(r0, Operand(Smi::FromInt(count_value))); | 4453 __ mov(r0, Operand(Smi::FromInt(count_value))); |
| 4460 | 4454 |
| 4461 // Record position before stub call. | 4455 // Record position before stub call. |
| 4462 SetSourcePosition(expr->position()); | 4456 SetSourcePosition(expr->position()); |
| 4463 | 4457 |
| 4464 BinaryOpStub stub(Token::ADD, NO_OVERWRITE); | 4458 BinaryOpStub stub(Token::ADD); |
| 4465 CallIC(stub.GetCode(isolate()), | 4459 CallIC(stub.GetCode(isolate()), |
| 4466 RelocInfo::CODE_TARGET, | 4460 RelocInfo::CODE_TARGET, |
| 4467 expr->CountBinOpFeedbackId()); | 4461 expr->CountBinOpFeedbackId()); |
| 4468 patch_site.EmitPatchInfo(); | 4462 patch_site.EmitPatchInfo(); |
| 4469 __ bind(&done); | 4463 __ bind(&done); |
| 4470 | 4464 |
| 4471 // Store the value returned in r0. | 4465 // Store the value returned in r0. |
| 4472 switch (assign_type) { | 4466 switch (assign_type) { |
| 4473 case VARIABLE: | 4467 case VARIABLE: |
| 4474 if (expr->is_postfix()) { | 4468 if (expr->is_postfix()) { |
| (...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4890 *context_length = 0; | 4884 *context_length = 0; |
| 4891 return previous_; | 4885 return previous_; |
| 4892 } | 4886 } |
| 4893 | 4887 |
| 4894 | 4888 |
| 4895 #undef __ | 4889 #undef __ |
| 4896 | 4890 |
| 4897 } } // namespace v8::internal | 4891 } } // namespace v8::internal |
| 4898 | 4892 |
| 4899 #endif // V8_TARGET_ARCH_ARM | 4893 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |