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

Unified Diff: src/ia32/code-stubs-ia32.cc

Issue 3388004: Add support for near labels.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 10 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: src/ia32/code-stubs-ia32.cc
===================================================================
--- src/ia32/code-stubs-ia32.cc (revision 5449)
+++ src/ia32/code-stubs-ia32.cc (working copy)
@@ -208,7 +208,7 @@
// NOTE: The stub does not handle the inlined cases (Smis, Booleans, undefined).
void ToBooleanStub::Generate(MacroAssembler* masm) {
- Label false_result, true_result, not_string;
+ NearLabel false_result, true_result, not_string;
__ mov(eax, Operand(esp, 1 * kPointerSize));
// 'null' => false.
@@ -966,7 +966,7 @@
__ bind(&non_smi_result);
// Allocate a heap number if needed.
__ mov(ebx, Operand(eax)); // ebx: result
- Label skip_allocation;
+ NearLabel skip_allocation;
switch (mode_) {
case OVERWRITE_LEFT:
case OVERWRITE_RIGHT:
@@ -1036,7 +1036,7 @@
}
// Test if left operand is a string.
- Label lhs_not_string;
+ NearLabel lhs_not_string;
__ test(lhs, Immediate(kSmiTagMask));
__ j(zero, &lhs_not_string);
__ CmpObjectType(lhs, FIRST_NONSTRING_TYPE, ecx);
@@ -1045,7 +1045,7 @@
StringAddStub string_add_left_stub(NO_STRING_CHECK_LEFT_IN_STUB);
__ TailCallStub(&string_add_left_stub);
- Label call_runtime_with_args;
+ NearLabel call_runtime_with_args;
// Left operand is not a string, test right.
__ bind(&lhs_not_string);
__ test(rhs, Immediate(kSmiTagMask));
@@ -1221,8 +1221,8 @@
// Test that eax is a number.
Label runtime_call;
Label runtime_call_clear_stack;
- Label input_not_smi;
- Label loaded;
+ NearLabel input_not_smi;
+ NearLabel loaded;
__ mov(eax, Operand(esp, kPointerSize));
__ test(eax, Immediate(kSmiTagMask));
__ j(not_zero, &input_not_smi);
@@ -1295,7 +1295,7 @@
__ lea(ecx, Operand(ecx, ecx, times_2, 0));
__ lea(ecx, Operand(eax, ecx, times_4, 0));
// Check if cache matches: Double value is stored in uint32_t[2] array.
- Label cache_miss;
+ NearLabel cache_miss;
__ cmp(ebx, Operand(ecx, 0));
__ j(not_equal, &cache_miss);
__ cmp(edx, Operand(ecx, kIntSize));
@@ -1338,7 +1338,7 @@
void TranscendentalCacheStub::GenerateOperation(MacroAssembler* masm) {
// Only free register is edi.
- Label done;
+ NearLabel done;
ASSERT(type_ == TranscendentalCache::SIN ||
type_ == TranscendentalCache::COS);
// More transcendental types can be added later.
@@ -1346,7 +1346,7 @@
// Both fsin and fcos require arguments in the range +/-2^63 and
// return NaN for infinities and NaN. They can share all code except
// the actual fsin/fcos operation.
- Label in_range;
+ NearLabel in_range;
// If argument is outside the range -2^63..2^63, fsin/cos doesn't
// work. We must reduce it to the appropriate range.
__ mov(edi, edx);
@@ -1357,7 +1357,7 @@
__ j(below, &in_range, taken);
// Check for infinity and NaN. Both return NaN for sin.
__ cmp(Operand(edi), Immediate(0x7ff00000));
- Label non_nan_result;
+ NearLabel non_nan_result;
__ j(not_equal, &non_nan_result, taken);
// Input is +/-Infinity or NaN. Result is NaN.
__ fstp(0);
@@ -1377,7 +1377,7 @@
__ fld(1);
// FPU Stack: input, 2*pi, input.
{
- Label no_exceptions;
+ NearLabel no_exceptions;
__ fwait();
__ fnstsw_ax();
// Clear if Illegal Operand or Zero Division exceptions are set.
@@ -1389,7 +1389,7 @@
// Compute st(0) % st(1)
{
- Label partial_remainder_loop;
+ NearLabel partial_remainder_loop;
__ bind(&partial_remainder_loop);
__ fprem1();
__ fwait();
@@ -1552,7 +1552,7 @@
__ shr_cl(scratch2);
// Now the unsigned answer is in scratch2. We need to move it to ecx and
// we may need to fix the sign.
- Label negative;
+ NearLabel negative;
__ xor_(ecx, Operand(ecx));
__ cmp(ecx, FieldOperand(source, HeapNumber::kExponentOffset));
__ j(greater, &negative);
@@ -1702,7 +1702,7 @@
void FloatingPointHelper::LoadFloatOperand(MacroAssembler* masm,
Register number) {
- Label load_smi, done;
+ NearLabel load_smi, done;
__ test(number, Immediate(kSmiTagMask));
__ j(zero, &load_smi, not_taken);
@@ -1720,7 +1720,7 @@
void FloatingPointHelper::LoadSSE2Operands(MacroAssembler* masm) {
- Label load_smi_edx, load_eax, load_smi_eax, done;
+ NearLabel load_smi_edx, load_eax, load_smi_eax, done;
// Load operand in edx into xmm0.
__ test(edx, Immediate(kSmiTagMask));
__ j(zero, &load_smi_edx, not_taken); // Argument in edx is a smi.
@@ -1750,7 +1750,7 @@
void FloatingPointHelper::LoadSSE2Operands(MacroAssembler* masm,
Label* not_numbers) {
- Label load_smi_edx, load_eax, load_smi_eax, load_float_eax, done;
+ NearLabel load_smi_edx, load_eax, load_smi_eax, load_float_eax, done;
// Load operand in edx into xmm0, or branch to not_numbers.
__ test(edx, Immediate(kSmiTagMask));
__ j(zero, &load_smi_edx, not_taken); // Argument in edx is a smi.
@@ -1798,7 +1798,7 @@
void FloatingPointHelper::LoadFloatOperands(MacroAssembler* masm,
Register scratch,
ArgLocation arg_location) {
- Label load_smi_1, load_smi_2, done_load_1, done;
+ NearLabel load_smi_1, load_smi_2, done_load_1, done;
if (arg_location == ARGS_IN_REGISTERS) {
__ mov(scratch, edx);
} else {
@@ -1857,7 +1857,7 @@
void FloatingPointHelper::CheckFloatOperands(MacroAssembler* masm,
Label* non_float,
Register scratch) {
- Label test_other, done;
+ NearLabel test_other, done;
// Test if both operands are floats or smi -> scratch=k_is_float;
// Otherwise scratch = k_not_float.
__ test(edx, Immediate(kSmiTagMask));
@@ -1883,7 +1883,7 @@
if (op_ == Token::SUB) {
// Check whether the value is a smi.
- Label try_float;
+ NearLabel try_float;
__ test(eax, Immediate(kSmiTagMask));
__ j(not_zero, &try_float, not_taken);
@@ -1941,7 +1941,7 @@
&slow);
// Do the bitwise operation and check if the result fits in a smi.
- Label try_float;
+ NearLabel try_float;
__ not_(ecx);
__ cmp(ecx, 0xc0000000);
__ j(sign, &try_float, not_taken);
@@ -2010,7 +2010,7 @@
__ j(not_zero, &slow, not_taken);
// Check if the calling frame is an arguments adaptor frame.
- Label adaptor;
+ NearLabel adaptor;
__ mov(ebx, Operand(ebp, StandardFrameConstants::kCallerFPOffset));
__ mov(ecx, Operand(ebx, StandardFrameConstants::kContextOffset));
__ cmp(Operand(ecx), Immediate(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)));
@@ -2087,7 +2087,7 @@
// Try the new space allocation. Start out with computing the size of
// the arguments object and the elements array.
- Label add_arguments_object;
+ NearLabel add_arguments_object;
__ bind(&try_allocate);
__ test(ecx, Operand(ecx));
__ j(zero, &add_arguments_object);
@@ -2139,7 +2139,7 @@
__ SmiUntag(ecx);
// Copy the fixed array slots.
- Label loop;
+ NearLabel loop;
__ bind(&loop);
__ mov(ebx, Operand(edx, -1 * kPointerSize)); // Skip receiver.
__ mov(FieldOperand(edi, FixedArray::kHeaderSize), ebx);
@@ -2367,7 +2367,7 @@
// Argument 4: End of string data
// Argument 3: Start of string data
- Label setup_two_byte, setup_rest;
+ NearLabel setup_two_byte, setup_rest;
__ test(edi, Operand(edi));
__ mov(edi, FieldOperand(eax, String::kLengthOffset));
__ j(zero, &setup_two_byte);
@@ -2461,7 +2461,7 @@
// ebx: last_match_info backing store (FixedArray)
// ecx: offsets vector
// edx: number of capture registers
- Label next_capture, done;
+ NearLabel next_capture, done;
// Capture register counter starts from number of capture registers and
// counts down until wraping after zero.
__ bind(&next_capture);
@@ -2517,13 +2517,13 @@
// number string cache for smis is just the smi value, and the hash for
// doubles is the xor of the upper and lower words. See
// Heap::GetNumberStringCache.
- Label smi_hash_calculated;
- Label load_result_from_cache;
+ NearLabel smi_hash_calculated;
+ NearLabel load_result_from_cache;
if (object_is_smi) {
__ mov(scratch, object);
__ SmiUntag(scratch);
} else {
- Label not_smi, hash_calculated;
+ NearLabel not_smi, hash_calculated;
STATIC_ASSERT(kSmiTag == 0);
__ test(object, Immediate(kSmiTagMask));
__ j(not_zero, &not_smi);
@@ -2626,7 +2626,7 @@
if (cc_ != equal) {
// Check for undefined. undefined OP undefined is false even though
// undefined == undefined.
- Label check_for_nan;
+ NearLabel check_for_nan;
__ cmp(edx, Factory::undefined_value());
__ j(not_equal, &check_for_nan);
__ Set(eax, Immediate(Smi::FromInt(NegativeComparisonResult(cc_))));
@@ -2641,7 +2641,7 @@
__ Set(eax, Immediate(Smi::FromInt(EQUAL)));
__ ret(0);
} else {
- Label heap_number;
+ NearLabel heap_number;
__ cmp(FieldOperand(edx, HeapObject::kMapOffset),
Immediate(Factory::heap_number_map()));
__ j(equal, &heap_number);
@@ -2676,7 +2676,7 @@
__ setcc(above_equal, eax);
__ ret(0);
} else {
- Label nan;
+ NearLabel nan;
__ j(above_equal, &nan);
__ Set(eax, Immediate(Smi::FromInt(EQUAL)));
__ ret(0);
@@ -2693,7 +2693,7 @@
// Non-strict object equality is slower, so it is handled later in the stub.
if (cc_ == equal && strict_) {
Label slow; // Fallthrough label.
- Label not_smis;
+ NearLabel not_smis;
// If we're doing a strict equality comparison, we don't have to do
// type conversion, so we generate code to do fast comparison for objects
// and oddballs. Non-smi numbers and strings still go through the usual
@@ -2734,13 +2734,13 @@
// Get the type of the first operand.
// If the first object is a JS object, we have done pointer comparison.
- Label first_non_object;
+ NearLabel first_non_object;
STATIC_ASSERT(LAST_TYPE == JS_FUNCTION_TYPE);
__ CmpObjectType(eax, FIRST_JS_OBJECT_TYPE, ecx);
__ j(below, &first_non_object);
// Return non-zero (eax is not zero)
- Label return_not_equal;
+ NearLabel return_not_equal;
STATIC_ASSERT(kHeapObjectTag != 0);
__ bind(&return_not_equal);
__ ret(0);
@@ -2791,7 +2791,7 @@
// Don't base result on EFLAGS when a NaN is involved.
__ j(parity_even, &unordered, not_taken);
- Label below_label, above_label;
+ NearLabel below_label, above_label;
// Return a result of -1, 0, or 1, based on EFLAGS.
__ j(below, &below_label, not_taken);
__ j(above, &above_label, not_taken);
@@ -2856,8 +2856,8 @@
// Non-strict equality. Objects are unequal if
// they are both JSObjects and not undetectable,
// and their pointers are different.
- Label not_both_objects;
- Label return_unequal;
+ NearLabel not_both_objects;
+ NearLabel return_unequal;
// At most one is a smi, so we can test for smi by adding the two.
// A smi plus a heap object has the low bit set, a heap object plus
// a heap object has the low bit clear.
@@ -3019,7 +3019,7 @@
// not NULL. The frame pointer is NULL in the exception handler of
// a JS entry frame.
__ xor_(esi, Operand(esi)); // Tentatively set context pointer to NULL.
- Label skip;
+ NearLabel skip;
__ cmp(ebp, 0);
__ j(equal, &skip, not_taken);
__ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset));
@@ -3151,7 +3151,7 @@
// Make sure we're not trying to return 'the hole' from the runtime
// call as this may lead to crashes in the IC code later.
if (FLAG_debug_code) {
- Label okay;
+ NearLabel okay;
__ cmp(eax, Factory::the_hole_value());
__ j(not_equal, &okay);
__ int3();
@@ -3213,7 +3213,7 @@
__ mov(esp, Operand::StaticVariable(handler_address));
// Unwind the handlers until the ENTRY handler is found.
- Label loop, done;
+ NearLabel loop, done;
__ bind(&loop);
// Load the type of the current stack handler.
const int kStateOffset = StackHandlerConstants::kStateOffset;
@@ -3431,7 +3431,7 @@
// edx is function, eax is map.
// Look up the function and the map in the instanceof cache.
- Label miss;
+ NearLabel miss;
ExternalReference roots_address = ExternalReference::roots_address();
__ mov(ecx, Immediate(Heap::kInstanceofCacheFunctionRootIndex));
__ cmp(edx, Operand::StaticArray(ecx, times_pointer_size, roots_address));
@@ -3463,7 +3463,7 @@
__ mov(ecx, FieldOperand(eax, Map::kPrototypeOffset));
// Loop through the prototype chain looking for the function prototype.
- Label loop, is_instance, is_not_instance;
+ NearLabel loop, is_instance, is_not_instance;
__ bind(&loop);
__ cmp(ecx, Operand(ebx));
__ j(equal, &is_instance);
@@ -3793,7 +3793,7 @@
// eax: first string
// edx: second string
// Check if either of the strings are empty. In that case return the other.
- Label second_not_zero_length, both_not_zero_length;
+ NearLabel second_not_zero_length, both_not_zero_length;
__ mov(ecx, FieldOperand(edx, String::kLengthOffset));
STATIC_ASSERT(kSmiTag == 0);
__ test(ecx, Operand(ecx));
@@ -4079,7 +4079,7 @@
Register count,
Register scratch,
bool ascii) {
- Label loop;
+ NearLabel loop;
__ bind(&loop);
// This loop just copies one character at a time, as it is only used for very
// short strings.
@@ -4126,7 +4126,7 @@
}
// Don't enter the rep movs if there are less than 4 bytes to copy.
- Label last_bytes;
+ NearLabel last_bytes;
__ test(count, Immediate(~3));
__ j(zero, &last_bytes);
@@ -4146,7 +4146,7 @@
__ j(zero, &done);
// Copy remaining characters.
- Label loop;
+ NearLabel loop;
__ bind(&loop);
__ mov_b(scratch, Operand(src, 0));
__ mov_b(Operand(dest, 0), scratch);
@@ -4172,7 +4172,7 @@
// Make sure that both characters are not digits as such strings has a
// different hash algorithm. Don't try to look for these in the symbol table.
- Label not_array_index;
+ NearLabel not_array_index;
__ mov(scratch, c1);
__ sub(Operand(scratch), Immediate(static_cast<int>('0')));
__ cmp(Operand(scratch), Immediate(static_cast<int>('9' - '0')));
@@ -4330,7 +4330,7 @@
__ add(hash, Operand(scratch));
// if (hash == 0) hash = 27;
- Label hash_not_zero;
+ NearLabel hash_not_zero;
__ test(hash, Operand(hash));
__ j(not_zero, &hash_not_zero);
__ mov(hash, Immediate(27));
@@ -4499,7 +4499,7 @@
__ IncrementCounter(&Counters::string_compare_native, 1);
// Find minimum length.
- Label left_shorter;
+ NearLabel left_shorter;
__ mov(scratch1, FieldOperand(left, String::kLengthOffset));
__ mov(scratch3, scratch1);
__ sub(scratch3, FieldOperand(right, String::kLengthOffset));
@@ -4535,7 +4535,7 @@
{
// Compare loop.
- Label loop;
+ NearLabel loop;
__ bind(&loop);
// Compare characters.
__ mov_b(scratch2, Operand(left, index, times_1, 0));
@@ -4581,7 +4581,7 @@
__ mov(edx, Operand(esp, 2 * kPointerSize)); // left
__ mov(eax, Operand(esp, 1 * kPointerSize)); // right
- Label not_same;
+ NearLabel not_same;
__ cmp(edx, Operand(eax));
__ j(not_equal, &not_same);
STATIC_ASSERT(EQUAL == 0);

Powered by Google App Engine
This is Rietveld 408576698