OLD | NEW |
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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 | 154 |
155 static void PushInterceptorArguments(MacroAssembler* masm, | 155 static void PushInterceptorArguments(MacroAssembler* masm, |
156 Register receiver, | 156 Register receiver, |
157 Register holder, | 157 Register holder, |
158 Register name, | 158 Register name, |
159 JSObject* holder_obj) { | 159 JSObject* holder_obj) { |
160 __ push(receiver); | 160 __ push(receiver); |
161 __ push(holder); | 161 __ push(holder); |
162 __ push(name); | 162 __ push(name); |
163 InterceptorInfo* interceptor = holder_obj->GetNamedInterceptor(); | 163 InterceptorInfo* interceptor = holder_obj->GetNamedInterceptor(); |
| 164 ASSERT(!Heap::InNewSpace(interceptor)); |
164 __ mov(receiver, Immediate(Handle<Object>(interceptor))); | 165 __ mov(receiver, Immediate(Handle<Object>(interceptor))); |
165 __ push(receiver); | 166 __ push(receiver); |
166 __ push(FieldOperand(receiver, InterceptorInfo::kDataOffset)); | 167 __ push(FieldOperand(receiver, InterceptorInfo::kDataOffset)); |
167 } | 168 } |
168 | 169 |
169 | 170 |
170 void StubCompiler::GenerateLoadGlobalFunctionPrototype(MacroAssembler* masm, | 171 void StubCompiler::GenerateLoadGlobalFunctionPrototype(MacroAssembler* masm, |
171 int index, | 172 int index, |
172 Register prototype) { | 173 Register prototype) { |
173 // Load the global or builtins object from the current context. | 174 // Load the global or builtins object from the current context. |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 compiler->CompileRegular(masm, | 341 compiler->CompileRegular(masm, |
341 receiver, | 342 receiver, |
342 reg, | 343 reg, |
343 scratch2, | 344 scratch2, |
344 holder, | 345 holder, |
345 miss); | 346 miss); |
346 } | 347 } |
347 } | 348 } |
348 | 349 |
349 | 350 |
350 static void LookupPostInterceptor(JSObject* holder, | |
351 String* name, | |
352 LookupResult* lookup) { | |
353 holder->LocalLookupRealNamedProperty(name, lookup); | |
354 if (lookup->IsNotFound()) { | |
355 Object* proto = holder->GetPrototype(); | |
356 if (proto != Heap::null_value()) { | |
357 proto->Lookup(name, lookup); | |
358 } | |
359 } | |
360 } | |
361 | |
362 | |
363 class LoadInterceptorCompiler BASE_EMBEDDED { | 351 class LoadInterceptorCompiler BASE_EMBEDDED { |
364 public: | 352 public: |
365 explicit LoadInterceptorCompiler(Register name) : name_(name) {} | 353 explicit LoadInterceptorCompiler(Register name) : name_(name) {} |
366 | 354 |
367 void CompileCacheable(MacroAssembler* masm, | 355 void CompileCacheable(MacroAssembler* masm, |
368 StubCompiler* stub_compiler, | 356 StubCompiler* stub_compiler, |
369 Register receiver, | 357 Register receiver, |
370 Register holder, | 358 Register holder, |
371 Register scratch1, | 359 Register scratch1, |
372 Register scratch2, | 360 Register scratch2, |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
552 __ mov(edx, FieldOperand(edx, GlobalObject::kGlobalReceiverOffset)); | 540 __ mov(edx, FieldOperand(edx, GlobalObject::kGlobalReceiverOffset)); |
553 __ mov(Operand(esp, (argc_ + 1) * kPointerSize), edx); | 541 __ mov(Operand(esp, (argc_ + 1) * kPointerSize), edx); |
554 } | 542 } |
555 | 543 |
556 ASSERT(function->is_compiled()); | 544 ASSERT(function->is_compiled()); |
557 // Get the function and setup the context. | 545 // Get the function and setup the context. |
558 __ mov(edi, Immediate(Handle<JSFunction>(function))); | 546 __ mov(edi, Immediate(Handle<JSFunction>(function))); |
559 __ mov(esi, FieldOperand(edi, JSFunction::kContextOffset)); | 547 __ mov(esi, FieldOperand(edi, JSFunction::kContextOffset)); |
560 | 548 |
561 // Jump to the cached code (tail call). | 549 // Jump to the cached code (tail call). |
562 ASSERT(function->is_compiled()); | |
563 Handle<Code> code(function->code()); | 550 Handle<Code> code(function->code()); |
564 ParameterCount expected(function->shared()->formal_parameter_count()); | 551 ParameterCount expected(function->shared()->formal_parameter_count()); |
565 __ InvokeCode(code, expected, arguments_, | 552 __ InvokeCode(code, expected, arguments_, |
566 RelocInfo::CODE_TARGET, JUMP_FUNCTION); | 553 RelocInfo::CODE_TARGET, JUMP_FUNCTION); |
567 | 554 |
568 __ bind(&invoke); | 555 __ bind(&invoke); |
569 } | 556 } |
570 | 557 |
571 void CompileRegular(MacroAssembler* masm, | 558 void CompileRegular(MacroAssembler* masm, |
572 Register receiver, | 559 Register receiver, |
(...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1144 __ j(not_equal, &miss, not_taken); | 1131 __ j(not_equal, &miss, not_taken); |
1145 | 1132 |
1146 // Patch the receiver on the stack with the global proxy if | 1133 // Patch the receiver on the stack with the global proxy if |
1147 // necessary. | 1134 // necessary. |
1148 if (object->IsGlobalObject()) { | 1135 if (object->IsGlobalObject()) { |
1149 __ mov(edx, FieldOperand(edx, GlobalObject::kGlobalReceiverOffset)); | 1136 __ mov(edx, FieldOperand(edx, GlobalObject::kGlobalReceiverOffset)); |
1150 __ mov(Operand(esp, (argc + 1) * kPointerSize), edx); | 1137 __ mov(Operand(esp, (argc + 1) * kPointerSize), edx); |
1151 } | 1138 } |
1152 | 1139 |
1153 // Invoke the function. | 1140 // Invoke the function. |
| 1141 // TODO(antonm): check if this move is necessary. |
1154 __ mov(edi, eax); | 1142 __ mov(edi, eax); |
1155 __ InvokeFunction(edi, arguments(), JUMP_FUNCTION); | 1143 __ InvokeFunction(edi, arguments(), JUMP_FUNCTION); |
1156 | 1144 |
1157 // Handle load cache miss. | 1145 // Handle load cache miss. |
1158 __ bind(&miss); | 1146 __ bind(&miss); |
1159 Handle<Code> ic = ComputeCallMiss(argc); | 1147 Handle<Code> ic = ComputeCallMiss(argc); |
1160 __ jmp(ic, RelocInfo::CODE_TARGET); | 1148 __ jmp(ic, RelocInfo::CODE_TARGET); |
1161 | 1149 |
1162 // Return the generated code. | 1150 // Return the generated code. |
1163 return GetCode(INTERCEPTOR, name); | 1151 return GetCode(INTERCEPTOR, name); |
(...skipping 803 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1967 __ jmp(generic_construct_stub, RelocInfo::CODE_TARGET); | 1955 __ jmp(generic_construct_stub, RelocInfo::CODE_TARGET); |
1968 | 1956 |
1969 // Return the generated code. | 1957 // Return the generated code. |
1970 return GetCode(); | 1958 return GetCode(); |
1971 } | 1959 } |
1972 | 1960 |
1973 | 1961 |
1974 #undef __ | 1962 #undef __ |
1975 | 1963 |
1976 } } // namespace v8::internal | 1964 } } // namespace v8::internal |
OLD | NEW |