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

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

Issue 8404030: Version 3.7.1 (Closed) Base URL: http://v8.googlecode.com/svn/trunk/
Patch Set: Created 9 years, 1 month 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/ia32/regexp-macro-assembler-ia32.cc » ('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 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 push(Immediate(x.x_ ^ jit_cookie())); 345 push(Immediate(x.x_ ^ jit_cookie()));
346 xor_(Operand(esp, 0), Immediate(jit_cookie())); 346 xor_(Operand(esp, 0), Immediate(jit_cookie()));
347 } else { 347 } else {
348 push(x); 348 push(x);
349 } 349 }
350 } 350 }
351 351
352 352
353 void MacroAssembler::CompareRoot(Register with, Heap::RootListIndex index) { 353 void MacroAssembler::CompareRoot(Register with, Heap::RootListIndex index) {
354 // see ROOT_ACCESSOR macro in factory.h 354 // see ROOT_ACCESSOR macro in factory.h
355 Handle<Object> value(&isolate()->heap()->roots_address()[index]); 355 Handle<Object> value(&isolate()->heap()->roots_array_start()[index]);
356 cmp(with, value); 356 cmp(with, value);
357 } 357 }
358 358
359 359
360 void MacroAssembler::CmpObjectType(Register heap_object, 360 void MacroAssembler::CmpObjectType(Register heap_object,
361 InstanceType type, 361 InstanceType type,
362 Register map) { 362 Register map) {
363 mov(map, FieldOperand(heap_object, HeapObject::kMapOffset)); 363 mov(map, FieldOperand(heap_object, HeapObject::kMapOffset));
364 CmpInstanceType(map, type); 364 CmpInstanceType(map, type);
365 } 365 }
(...skipping 1119 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 514 matching lines...) Expand 10 before | Expand all | Expand 10 after
2057 2080
2058 2081
2059 void MacroAssembler::InvokeFunction(JSFunction* function, 2082 void MacroAssembler::InvokeFunction(JSFunction* function,
2060 const ParameterCount& actual, 2083 const ParameterCount& actual,
2061 InvokeFlag flag, 2084 InvokeFlag flag,
2062 const CallWrapper& call_wrapper, 2085 const CallWrapper& call_wrapper,
2063 CallKind call_kind) { 2086 CallKind call_kind) {
2064 // You can't call a function without a valid frame. 2087 // You can't call a function without a valid frame.
2065 ASSERT(flag == JUMP_FUNCTION || has_frame()); 2088 ASSERT(flag == JUMP_FUNCTION || has_frame());
2066 2089
2067 ASSERT(function->is_compiled());
2068 // Get the function and setup the context. 2090 // Get the function and setup the context.
2069 mov(edi, Immediate(Handle<JSFunction>(function))); 2091 mov(edi, Immediate(Handle<JSFunction>(function)));
2070 mov(esi, FieldOperand(edi, JSFunction::kContextOffset)); 2092 mov(esi, FieldOperand(edi, JSFunction::kContextOffset));
2071 2093
2072 ParameterCount expected(function->shared()->formal_parameter_count()); 2094 ParameterCount expected(function->shared()->formal_parameter_count());
2073 if (V8::UseCrankshaft()) { 2095 // We call indirectly through the code field in the function to
2074 // TODO(kasperl): For now, we always call indirectly through the 2096 // allow recompilation to take effect without changing any of the
2075 // code field in the function to allow recompilation to take effect 2097 // call sites.
2076 // without changing any of the call sites. 2098 InvokeCode(FieldOperand(edi, JSFunction::kCodeEntryOffset),
2077 InvokeCode(FieldOperand(edi, JSFunction::kCodeEntryOffset), 2099 expected, actual, flag, call_wrapper, call_kind);
2078 expected, actual, flag, call_wrapper, call_kind);
2079 } else {
2080 Handle<Code> code(function->code());
2081 InvokeCode(code, expected, actual, RelocInfo::CODE_TARGET,
2082 flag, call_wrapper, call_kind);
2083 }
2084 } 2100 }
2085 2101
2086 2102
2087 void MacroAssembler::InvokeBuiltin(Builtins::JavaScript id, 2103 void MacroAssembler::InvokeBuiltin(Builtins::JavaScript id,
2088 InvokeFlag flag, 2104 InvokeFlag flag,
2089 const CallWrapper& call_wrapper) { 2105 const CallWrapper& call_wrapper) {
2090 // You can't call a builtin without a valid frame. 2106 // You can't call a builtin without a valid frame.
2091 ASSERT(flag == JUMP_FUNCTION || has_frame()); 2107 ASSERT(flag == JUMP_FUNCTION || has_frame());
2092 2108
2093 // Rely on the assertion to check that the number of provided 2109 // Rely on the assertion to check that the number of provided
(...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after
2711 cmp(length, Operand(bitmap_scratch, MemoryChunk::kSizeOffset)); 2727 cmp(length, Operand(bitmap_scratch, MemoryChunk::kSizeOffset));
2712 Check(less_equal, "Live Bytes Count overflow chunk size"); 2728 Check(less_equal, "Live Bytes Count overflow chunk size");
2713 } 2729 }
2714 2730
2715 bind(&done); 2731 bind(&done);
2716 } 2732 }
2717 2733
2718 } } // namespace v8::internal 2734 } } // namespace v8::internal
2719 2735
2720 #endif // V8_TARGET_ARCH_IA32 2736 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/macro-assembler-ia32.h ('k') | src/ia32/regexp-macro-assembler-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698