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

Side by Side Diff: src/ia32/macro-assembler-ia32.cc

Issue 8199004: Reimplement Function.prototype.bind. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed review comments Created 9 years, 2 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
« no previous file with comments | « src/ia32/macro-assembler-ia32.h ('k') | src/macros.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 1474 matching lines...) Expand 10 before | Expand all | Expand 10 after
1485 jmp(&entry); 1485 jmp(&entry);
1486 bind(&loop); 1486 bind(&loop);
1487 mov(Operand(start_offset, 0), filler); 1487 mov(Operand(start_offset, 0), filler);
1488 add(start_offset, Immediate(kPointerSize)); 1488 add(start_offset, Immediate(kPointerSize));
1489 bind(&entry); 1489 bind(&entry);
1490 cmp(start_offset, end_offset); 1490 cmp(start_offset, end_offset);
1491 j(less, &loop); 1491 j(less, &loop);
1492 } 1492 }
1493 1493
1494 1494
1495 void MacroAssembler::BooleanBitTest(Register object,
1496 int field_offset,
1497 int bit_index) {
1498 bit_index += kSmiTagSize + kSmiShiftSize;
1499 ASSERT(IsPowerOf2(kBitsPerByte));
1500 int byte_index = bit_index / kBitsPerByte;
1501 int byte_bit_index = bit_index & (kBitsPerByte - 1);
1502 test_b(FieldOperand(object, field_offset + byte_index),
1503 static_cast<byte>(1 << byte_bit_index));
1504 }
1505
1506
1507
1495 void MacroAssembler::NegativeZeroTest(Register result, 1508 void MacroAssembler::NegativeZeroTest(Register result,
1496 Register op, 1509 Register op,
1497 Label* then_label) { 1510 Label* then_label) {
1498 Label ok; 1511 Label ok;
1499 test(result, result); 1512 test(result, result);
1500 j(not_zero, &ok); 1513 j(not_zero, &ok);
1501 test(op, op); 1514 test(op, op);
1502 j(sign, then_label); 1515 j(sign, then_label);
1503 bind(&ok); 1516 bind(&ok);
1504 } 1517 }
(...skipping 10 matching lines...) Expand all
1515 mov(scratch, op1); 1528 mov(scratch, op1);
1516 or_(scratch, op2); 1529 or_(scratch, op2);
1517 j(sign, then_label); 1530 j(sign, then_label);
1518 bind(&ok); 1531 bind(&ok);
1519 } 1532 }
1520 1533
1521 1534
1522 void MacroAssembler::TryGetFunctionPrototype(Register function, 1535 void MacroAssembler::TryGetFunctionPrototype(Register function,
1523 Register result, 1536 Register result,
1524 Register scratch, 1537 Register scratch,
1525 Label* miss) { 1538 Label* miss,
1539 bool miss_on_bound_function) {
1526 // Check that the receiver isn't a smi. 1540 // Check that the receiver isn't a smi.
1527 JumpIfSmi(function, miss); 1541 JumpIfSmi(function, miss);
1528 1542
1529 // Check that the function really is a function. 1543 // Check that the function really is a function.
1530 CmpObjectType(function, JS_FUNCTION_TYPE, result); 1544 CmpObjectType(function, JS_FUNCTION_TYPE, result);
1531 j(not_equal, miss); 1545 j(not_equal, miss);
1532 1546
1547 if (miss_on_bound_function) {
1548 // If a bound function, go to miss label.
1549 mov(scratch,
1550 FieldOperand(function, JSFunction::kSharedFunctionInfoOffset));
1551 BooleanBitTest(scratch, SharedFunctionInfo::kCompilerHintsOffset,
1552 SharedFunctionInfo::kBoundFunction);
1553 j(not_zero, miss);
1554 }
1555
1533 // Make sure that the function has an instance prototype. 1556 // Make sure that the function has an instance prototype.
1534 Label non_instance; 1557 Label non_instance;
1535 movzx_b(scratch, FieldOperand(result, Map::kBitFieldOffset)); 1558 movzx_b(scratch, FieldOperand(result, Map::kBitFieldOffset));
1536 test(scratch, Immediate(1 << Map::kHasNonInstancePrototype)); 1559 test(scratch, Immediate(1 << Map::kHasNonInstancePrototype));
1537 j(not_zero, &non_instance); 1560 j(not_zero, &non_instance);
1538 1561
1539 // Get the prototype or initial map from the function. 1562 // Get the prototype or initial map from the function.
1540 mov(result, 1563 mov(result,
1541 FieldOperand(function, JSFunction::kPrototypeOrInitialMapOffset)); 1564 FieldOperand(function, JSFunction::kPrototypeOrInitialMapOffset));
1542 1565
(...skipping 1168 matching lines...) Expand 10 before | Expand all | Expand 10 after
2711 cmp(length, Operand(bitmap_scratch, MemoryChunk::kSizeOffset)); 2734 cmp(length, Operand(bitmap_scratch, MemoryChunk::kSizeOffset));
2712 Check(less_equal, "Live Bytes Count overflow chunk size"); 2735 Check(less_equal, "Live Bytes Count overflow chunk size");
2713 } 2736 }
2714 2737
2715 bind(&done); 2738 bind(&done);
2716 } 2739 }
2717 2740
2718 } } // namespace v8::internal 2741 } } // namespace v8::internal
2719 2742
2720 #endif // V8_TARGET_ARCH_IA32 2743 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/macro-assembler-ia32.h ('k') | src/macros.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698