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

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

Issue 5278003: Fix crashes during GC caused by partially initialized objects. The... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 10 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.cc ('k') | src/runtime.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 2006-2009 the V8 project authors. All rights reserved. 1 // Copyright 2006-2009 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 3003 matching lines...) Expand 10 before | Expand all | Expand 10 after
3014 __ DecrementCounter(&Counters::keyed_load_function_prototype, 1); 3014 __ DecrementCounter(&Counters::keyed_load_function_prototype, 1);
3015 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); 3015 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC);
3016 3016
3017 // Return the generated code. 3017 // Return the generated code.
3018 return GetCode(CALLBACKS, name); 3018 return GetCode(CALLBACKS, name);
3019 } 3019 }
3020 3020
3021 3021
3022 // Specialized stub for constructing objects from functions which only have only 3022 // Specialized stub for constructing objects from functions which only have only
3023 // simple assignments of the form this.x = ...; in their body. 3023 // simple assignments of the form this.x = ...; in their body.
3024 MaybeObject* ConstructStubCompiler::CompileConstructStub( 3024 MaybeObject* ConstructStubCompiler::CompileConstructStub(JSFunction* function) {
3025 SharedFunctionInfo* shared) {
3026 // ----------- S t a t e ------------- 3025 // ----------- S t a t e -------------
3027 // -- eax : argc 3026 // -- eax : argc
3028 // -- edi : constructor 3027 // -- edi : constructor
3029 // -- esp[0] : return address 3028 // -- esp[0] : return address
3030 // -- esp[4] : last argument 3029 // -- esp[4] : last argument
3031 // ----------------------------------- 3030 // -----------------------------------
3032 Label generic_stub_call; 3031 Label generic_stub_call;
3033 #ifdef ENABLE_DEBUGGER_SUPPORT 3032 #ifdef ENABLE_DEBUGGER_SUPPORT
3034 // Check to see whether there are any break points in the function code. If 3033 // Check to see whether there are any break points in the function code. If
3035 // there are jump to the generic constructor stub which calls the actual 3034 // there are jump to the generic constructor stub which calls the actual
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
3091 3090
3092 // Use edi for holding undefined which is used in several places below. 3091 // Use edi for holding undefined which is used in several places below.
3093 __ mov(edi, Factory::undefined_value()); 3092 __ mov(edi, Factory::undefined_value());
3094 3093
3095 // eax: argc 3094 // eax: argc
3096 // ecx: first argument 3095 // ecx: first argument
3097 // edx: first in-object property of the JSObject 3096 // edx: first in-object property of the JSObject
3098 // edi: undefined 3097 // edi: undefined
3099 // Fill the initialized properties with a constant value or a passed argument 3098 // Fill the initialized properties with a constant value or a passed argument
3100 // depending on the this.x = ...; assignment in the function. 3099 // depending on the this.x = ...; assignment in the function.
3100 SharedFunctionInfo* shared = function->shared();
3101 for (int i = 0; i < shared->this_property_assignments_count(); i++) { 3101 for (int i = 0; i < shared->this_property_assignments_count(); i++) {
3102 if (shared->IsThisPropertyAssignmentArgument(i)) { 3102 if (shared->IsThisPropertyAssignmentArgument(i)) {
3103 // Check if the argument assigned to the property is actually passed. 3103 // Check if the argument assigned to the property is actually passed.
3104 // If argument is not passed the property is set to undefined, 3104 // If argument is not passed the property is set to undefined,
3105 // otherwise find it on the stack. 3105 // otherwise find it on the stack.
3106 int arg_number = shared->GetThisPropertyAssignmentArgument(i); 3106 int arg_number = shared->GetThisPropertyAssignmentArgument(i);
3107 __ mov(ebx, edi); 3107 __ mov(ebx, edi);
3108 __ cmp(eax, arg_number); 3108 __ cmp(eax, arg_number);
3109 if (CpuFeatures::IsSupported(CMOV)) { 3109 if (CpuFeatures::IsSupported(CMOV)) {
3110 CpuFeatures::Scope use_cmov(CMOV); 3110 CpuFeatures::Scope use_cmov(CMOV);
3111 __ cmov(above, ebx, Operand(ecx, arg_number * -kPointerSize)); 3111 __ cmov(above, ebx, Operand(ecx, arg_number * -kPointerSize));
3112 } else { 3112 } else {
3113 Label not_passed; 3113 Label not_passed;
3114 __ j(below_equal, &not_passed); 3114 __ j(below_equal, &not_passed);
3115 __ mov(ebx, Operand(ecx, arg_number * -kPointerSize)); 3115 __ mov(ebx, Operand(ecx, arg_number * -kPointerSize));
3116 __ bind(&not_passed); 3116 __ bind(&not_passed);
3117 } 3117 }
3118 // Store value in the property. 3118 // Store value in the property.
3119 __ mov(Operand(edx, i * kPointerSize), ebx); 3119 __ mov(Operand(edx, i * kPointerSize), ebx);
3120 } else { 3120 } else {
3121 // Set the property to the constant value. 3121 // Set the property to the constant value.
3122 Handle<Object> constant(shared->GetThisPropertyAssignmentConstant(i)); 3122 Handle<Object> constant(shared->GetThisPropertyAssignmentConstant(i));
3123 __ mov(Operand(edx, i * kPointerSize), Immediate(constant)); 3123 __ mov(Operand(edx, i * kPointerSize), Immediate(constant));
3124 } 3124 }
3125 } 3125 }
3126 3126
3127 // Fill the unused in-object property fields with undefined. 3127 // Fill the unused in-object property fields with undefined.
3128 ASSERT(function->has_initial_map());
3128 for (int i = shared->this_property_assignments_count(); 3129 for (int i = shared->this_property_assignments_count();
3129 i < shared->CalculateInObjectProperties(); 3130 i < function->initial_map()->inobject_properties();
3130 i++) { 3131 i++) {
3131 __ mov(Operand(edx, i * kPointerSize), edi); 3132 __ mov(Operand(edx, i * kPointerSize), edi);
3132 } 3133 }
3133 3134
3134 // Move argc to ebx and retrieve and tag the JSObject to return. 3135 // Move argc to ebx and retrieve and tag the JSObject to return.
3135 __ mov(ebx, eax); 3136 __ mov(ebx, eax);
3136 __ pop(eax); 3137 __ pop(eax);
3137 __ or_(Operand(eax), Immediate(kHeapObjectTag)); 3138 __ or_(Operand(eax), Immediate(kHeapObjectTag));
3138 3139
3139 // Remove caller arguments and receiver from the stack and return. 3140 // Remove caller arguments and receiver from the stack and return.
(...skipping 14 matching lines...) Expand all
3154 // Return the generated code. 3155 // Return the generated code.
3155 return GetCode(); 3156 return GetCode();
3156 } 3157 }
3157 3158
3158 3159
3159 #undef __ 3160 #undef __
3160 3161
3161 } } // namespace v8::internal 3162 } } // namespace v8::internal
3162 3163
3163 #endif // V8_TARGET_ARCH_IA32 3164 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/macro-assembler-ia32.cc ('k') | src/runtime.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698