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

Side by Side Diff: src/ia32/stub-cache-ia32.cc

Issue 11293059: Fix slack tracking when instance prototype changes. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments by Daniel Clifford. Created 8 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/arm/stub-cache-arm.cc ('k') | src/mips/stub-cache-mips.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 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 3403 matching lines...) Expand 10 before | Expand all | Expand 10 after
3414 // Check to see whether there are any break points in the function code. If 3414 // Check to see whether there are any break points in the function code. If
3415 // there are jump to the generic constructor stub which calls the actual 3415 // there are jump to the generic constructor stub which calls the actual
3416 // code for the function thereby hitting the break points. 3416 // code for the function thereby hitting the break points.
3417 __ mov(ebx, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset)); 3417 __ mov(ebx, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset));
3418 __ mov(ebx, FieldOperand(ebx, SharedFunctionInfo::kDebugInfoOffset)); 3418 __ mov(ebx, FieldOperand(ebx, SharedFunctionInfo::kDebugInfoOffset));
3419 __ cmp(ebx, factory()->undefined_value()); 3419 __ cmp(ebx, factory()->undefined_value());
3420 __ j(not_equal, &generic_stub_call); 3420 __ j(not_equal, &generic_stub_call);
3421 #endif 3421 #endif
3422 3422
3423 // Load the initial map and verify that it is in fact a map. 3423 // Load the initial map and verify that it is in fact a map.
3424 // edi: constructor
3424 __ mov(ebx, FieldOperand(edi, JSFunction::kPrototypeOrInitialMapOffset)); 3425 __ mov(ebx, FieldOperand(edi, JSFunction::kPrototypeOrInitialMapOffset));
3425 // Will both indicate a NULL and a Smi. 3426 // Will both indicate a NULL and a Smi.
3426 __ JumpIfSmi(ebx, &generic_stub_call); 3427 __ JumpIfSmi(ebx, &generic_stub_call);
3427 __ CmpObjectType(ebx, MAP_TYPE, ecx); 3428 __ CmpObjectType(ebx, MAP_TYPE, ecx);
3428 __ j(not_equal, &generic_stub_call); 3429 __ j(not_equal, &generic_stub_call);
3429 3430
3430 #ifdef DEBUG 3431 #ifdef DEBUG
3431 // Cannot construct functions this way. 3432 // Cannot construct functions this way.
3432 // edi: constructor
3433 // ebx: initial map 3433 // ebx: initial map
3434 __ CmpInstanceType(ebx, JS_FUNCTION_TYPE); 3434 __ CmpInstanceType(ebx, JS_FUNCTION_TYPE);
3435 __ Assert(not_equal, "Function constructed by construct stub."); 3435 __ Check(not_equal, "Function constructed by construct stub.");
3436 #endif 3436 #endif
3437 3437
3438 // Now allocate the JSObject on the heap by moving the new space allocation 3438 // Now allocate the JSObject on the heap by moving the new space allocation
3439 // top forward. 3439 // top forward.
3440 // edi: constructor
3441 // ebx: initial map 3440 // ebx: initial map
3441 ASSERT(function->has_initial_map());
3442 int instance_size = function->initial_map()->instance_size();
3443 #ifdef DEBUG
3442 __ movzx_b(ecx, FieldOperand(ebx, Map::kInstanceSizeOffset)); 3444 __ movzx_b(ecx, FieldOperand(ebx, Map::kInstanceSizeOffset));
3443 __ shl(ecx, kPointerSizeLog2); 3445 __ shl(ecx, kPointerSizeLog2);
3444 __ AllocateInNewSpace(ecx, edx, ecx, no_reg, 3446 __ cmp(ecx, Immediate(instance_size));
3447 __ Check(equal, "Instance size of initial map changed.");
3448 #endif
3449 __ AllocateInNewSpace(instance_size, edx, ecx, no_reg,
3445 &generic_stub_call, NO_ALLOCATION_FLAGS); 3450 &generic_stub_call, NO_ALLOCATION_FLAGS);
3446 3451
3447 // Allocated the JSObject, now initialize the fields and add the heap tag. 3452 // Allocated the JSObject, now initialize the fields and add the heap tag.
3448 // ebx: initial map 3453 // ebx: initial map
3449 // edx: JSObject (untagged) 3454 // edx: JSObject (untagged)
3450 __ mov(Operand(edx, JSObject::kMapOffset), ebx); 3455 __ mov(Operand(edx, JSObject::kMapOffset), ebx);
3451 __ mov(ebx, factory()->empty_fixed_array()); 3456 __ mov(ebx, factory()->empty_fixed_array());
3452 __ mov(Operand(edx, JSObject::kPropertiesOffset), ebx); 3457 __ mov(Operand(edx, JSObject::kPropertiesOffset), ebx);
3453 __ mov(Operand(edx, JSObject::kElementsOffset), ebx); 3458 __ mov(Operand(edx, JSObject::kElementsOffset), ebx);
3454 3459
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
3494 // Store value in the property. 3499 // Store value in the property.
3495 __ mov(Operand(edx, i * kPointerSize), ebx); 3500 __ mov(Operand(edx, i * kPointerSize), ebx);
3496 } else { 3501 } else {
3497 // Set the property to the constant value. 3502 // Set the property to the constant value.
3498 Handle<Object> constant(shared->GetThisPropertyAssignmentConstant(i)); 3503 Handle<Object> constant(shared->GetThisPropertyAssignmentConstant(i));
3499 __ mov(Operand(edx, i * kPointerSize), Immediate(constant)); 3504 __ mov(Operand(edx, i * kPointerSize), Immediate(constant));
3500 } 3505 }
3501 } 3506 }
3502 3507
3503 // Fill the unused in-object property fields with undefined. 3508 // Fill the unused in-object property fields with undefined.
3504 ASSERT(function->has_initial_map());
3505 for (int i = shared->this_property_assignments_count(); 3509 for (int i = shared->this_property_assignments_count();
3506 i < function->initial_map()->inobject_properties(); 3510 i < function->initial_map()->inobject_properties();
3507 i++) { 3511 i++) {
3508 __ mov(Operand(edx, i * kPointerSize), edi); 3512 __ mov(Operand(edx, i * kPointerSize), edi);
3509 } 3513 }
3510 3514
3511 // Move argc to ebx and retrieve and tag the JSObject to return. 3515 // Move argc to ebx and retrieve and tag the JSObject to return.
3512 __ mov(ebx, eax); 3516 __ mov(ebx, eax);
3513 __ pop(eax); 3517 __ pop(eax);
3514 __ or_(eax, Immediate(kHeapObjectTag)); 3518 __ or_(eax, Immediate(kHeapObjectTag));
(...skipping 838 matching lines...) Expand 10 before | Expand all | Expand 10 after
4353 __ jmp(ic_slow, RelocInfo::CODE_TARGET); 4357 __ jmp(ic_slow, RelocInfo::CODE_TARGET);
4354 } 4358 }
4355 } 4359 }
4356 4360
4357 4361
4358 #undef __ 4362 #undef __
4359 4363
4360 } } // namespace v8::internal 4364 } } // namespace v8::internal
4361 4365
4362 #endif // V8_TARGET_ARCH_IA32 4366 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/arm/stub-cache-arm.cc ('k') | src/mips/stub-cache-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698