| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #if V8_TARGET_ARCH_MIPS | 5 #if V8_TARGET_ARCH_MIPS |
| 6 | 6 |
| 7 // Note on Mips implementation: | 7 // Note on Mips implementation: |
| 8 // | 8 // |
| 9 // The result_register() for mips is the 'v0' register, which is defined | 9 // The result_register() for mips is the 'v0' register, which is defined |
| 10 // by the ABI to contain function return values. However, the first | 10 // by the ABI to contain function return values. However, the first |
| (...skipping 1441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1452 __ CallRuntime(function_id, 2); | 1452 __ CallRuntime(function_id, 2); |
| 1453 __ bind(&done); | 1453 __ bind(&done); |
| 1454 context()->Plug(v0); | 1454 context()->Plug(v0); |
| 1455 } | 1455 } |
| 1456 } | 1456 } |
| 1457 } | 1457 } |
| 1458 | 1458 |
| 1459 | 1459 |
| 1460 void FullCodeGenerator::VisitRegExpLiteral(RegExpLiteral* expr) { | 1460 void FullCodeGenerator::VisitRegExpLiteral(RegExpLiteral* expr) { |
| 1461 Comment cmnt(masm_, "[ RegExpLiteral"); | 1461 Comment cmnt(masm_, "[ RegExpLiteral"); |
| 1462 Label materialized; | 1462 __ lw(a3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); |
| 1463 // Registers will be used as follows: | 1463 __ li(a2, Operand(Smi::FromInt(expr->literal_index()))); |
| 1464 // t1 = materialized value (RegExp literal) | 1464 __ li(a1, Operand(expr->pattern())); |
| 1465 // t0 = JS function, literals array | 1465 __ li(a0, Operand(expr->flags())); |
| 1466 // a3 = literal index | 1466 FastCloneRegExpStub stub(isolate()); |
| 1467 // a2 = RegExp pattern | 1467 __ CallStub(&stub); |
| 1468 // a1 = RegExp flags | |
| 1469 // a0 = RegExp literal clone | |
| 1470 __ lw(a0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); | |
| 1471 __ lw(t0, FieldMemOperand(a0, JSFunction::kLiteralsOffset)); | |
| 1472 int literal_offset = LiteralsArray::OffsetOfLiteralAt(expr->literal_index()); | |
| 1473 __ lw(t1, FieldMemOperand(t0, literal_offset)); | |
| 1474 __ LoadRoot(at, Heap::kUndefinedValueRootIndex); | |
| 1475 __ Branch(&materialized, ne, t1, Operand(at)); | |
| 1476 | |
| 1477 // Create regexp literal using runtime function. | |
| 1478 // Result will be in v0. | |
| 1479 __ li(a3, Operand(Smi::FromInt(expr->literal_index()))); | |
| 1480 __ li(a2, Operand(expr->pattern())); | |
| 1481 __ li(a1, Operand(expr->flags())); | |
| 1482 __ Push(t0, a3, a2, a1); | |
| 1483 __ CallRuntime(Runtime::kMaterializeRegExpLiteral, 4); | |
| 1484 __ mov(t1, v0); | |
| 1485 | |
| 1486 __ bind(&materialized); | |
| 1487 int size = JSRegExp::kSize + JSRegExp::kInObjectFieldCount * kPointerSize; | |
| 1488 Label allocated, runtime_allocate; | |
| 1489 __ Allocate(size, v0, a2, a3, &runtime_allocate, TAG_OBJECT); | |
| 1490 __ jmp(&allocated); | |
| 1491 | |
| 1492 __ bind(&runtime_allocate); | |
| 1493 __ li(a0, Operand(Smi::FromInt(size))); | |
| 1494 __ Push(t1, a0); | |
| 1495 __ CallRuntime(Runtime::kAllocateInNewSpace, 1); | |
| 1496 __ pop(t1); | |
| 1497 | |
| 1498 __ bind(&allocated); | |
| 1499 | |
| 1500 // After this, registers are used as follows: | |
| 1501 // v0: Newly allocated regexp. | |
| 1502 // t1: Materialized regexp. | |
| 1503 // a2: temp. | |
| 1504 __ CopyFields(v0, t1, a2.bit(), size / kPointerSize); | |
| 1505 context()->Plug(v0); | 1468 context()->Plug(v0); |
| 1506 } | 1469 } |
| 1507 | 1470 |
| 1508 | 1471 |
| 1509 void FullCodeGenerator::EmitAccessor(ObjectLiteralProperty* property) { | 1472 void FullCodeGenerator::EmitAccessor(ObjectLiteralProperty* property) { |
| 1510 Expression* expression = (property == NULL) ? NULL : property->value(); | 1473 Expression* expression = (property == NULL) ? NULL : property->value(); |
| 1511 if (expression == NULL) { | 1474 if (expression == NULL) { |
| 1512 __ LoadRoot(a1, Heap::kNullValueRootIndex); | 1475 __ LoadRoot(a1, Heap::kNullValueRootIndex); |
| 1513 __ push(a1); | 1476 __ push(a1); |
| 1514 } else { | 1477 } else { |
| (...skipping 3497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5012 reinterpret_cast<uint32_t>( | 4975 reinterpret_cast<uint32_t>( |
| 5013 isolate->builtins()->OsrAfterStackCheck()->entry())); | 4976 isolate->builtins()->OsrAfterStackCheck()->entry())); |
| 5014 return OSR_AFTER_STACK_CHECK; | 4977 return OSR_AFTER_STACK_CHECK; |
| 5015 } | 4978 } |
| 5016 | 4979 |
| 5017 | 4980 |
| 5018 } // namespace internal | 4981 } // namespace internal |
| 5019 } // namespace v8 | 4982 } // namespace v8 |
| 5020 | 4983 |
| 5021 #endif // V8_TARGET_ARCH_MIPS | 4984 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |