OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 } | 148 } |
149 | 149 |
150 | 150 |
151 bool Builtins::IsArgumentsAdaptorCall(Address pc) { | 151 bool Builtins::IsArgumentsAdaptorCall(Address pc) { |
152 ASSERT(arguments_adaptor_call_pc_offset_ > 0); | 152 ASSERT(arguments_adaptor_call_pc_offset_ > 0); |
153 int offset = pc - builtin(ArgumentsAdaptorTrampoline)->address(); | 153 int offset = pc - builtin(ArgumentsAdaptorTrampoline)->address(); |
154 return offset == arguments_adaptor_call_pc_offset_; | 154 return offset == arguments_adaptor_call_pc_offset_; |
155 } | 155 } |
156 | 156 |
157 | 157 |
| 158 Handle<Code> Builtins::GetCode(JavaScript id, bool* resolved) { |
| 159 Code* code = Builtins::builtin(Builtins::Illegal); |
| 160 *resolved = false; |
| 161 |
| 162 if (Top::security_context() != NULL) { |
| 163 Object* object = Top::security_context_builtins()->javascript_builtin(id); |
| 164 if (object->IsJSFunction()) { |
| 165 Handle<JSFunction> function(JSFunction::cast(object)); |
| 166 // Make sure the number of parameters match the formal parameter count. |
| 167 ASSERT(function->shared()->formal_parameter_count() == |
| 168 Builtins::GetArgumentsCount(id)); |
| 169 if (function->is_compiled() || CompileLazy(function, CLEAR_EXCEPTION)) { |
| 170 code = function->code(); |
| 171 *resolved = true; |
| 172 } |
| 173 } |
| 174 } |
| 175 |
| 176 return Handle<Code>(code); |
| 177 } |
| 178 |
| 179 |
158 BUILTIN_0(Illegal) { | 180 BUILTIN_0(Illegal) { |
159 UNREACHABLE(); | 181 UNREACHABLE(); |
160 } | 182 } |
161 BUILTIN_END | 183 BUILTIN_END |
162 | 184 |
163 | 185 |
164 BUILTIN_0(EmptyFunction) { | 186 BUILTIN_0(EmptyFunction) { |
165 } | 187 } |
166 BUILTIN_END | 188 BUILTIN_END |
167 | 189 |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 return holder; | 369 return holder; |
348 } | 370 } |
349 | 371 |
350 | 372 |
351 BUILTIN_0(HandleApiCall) { | 373 BUILTIN_0(HandleApiCall) { |
352 HandleScope scope; | 374 HandleScope scope; |
353 | 375 |
354 // TODO(1238487): This is not nice. We need to get rid of this | 376 // TODO(1238487): This is not nice. We need to get rid of this |
355 // kludgy behavior and start handling API calls in a more direct | 377 // kludgy behavior and start handling API calls in a more direct |
356 // way - maybe compile specialized stubs lazily?. | 378 // way - maybe compile specialized stubs lazily?. |
357 #ifdef USE_OLD_CALLING_CONVENTIONS | |
358 Handle<JSFunction> function = | |
359 Handle<JSFunction>(JSFunction::cast(__argv__[1])); | |
360 #else | |
361 Handle<JSFunction> function = | 379 Handle<JSFunction> function = |
362 Handle<JSFunction>(JSFunction::cast(Builtins::builtin_passed_function)); | 380 Handle<JSFunction>(JSFunction::cast(Builtins::builtin_passed_function)); |
363 #endif | |
364 | 381 |
365 if (is_construct) { | 382 if (is_construct) { |
366 Handle<FunctionTemplateInfo> desc = | 383 Handle<FunctionTemplateInfo> desc = |
367 Handle<FunctionTemplateInfo>( | 384 Handle<FunctionTemplateInfo>( |
368 FunctionTemplateInfo::cast(function->shared()->function_data())); | 385 FunctionTemplateInfo::cast(function->shared()->function_data())); |
369 bool pending_exception = false; | 386 bool pending_exception = false; |
370 Factory::ConfigureInstance(desc, Handle<JSObject>::cast(receiver), | 387 Factory::ConfigureInstance(desc, Handle<JSObject>::cast(receiver), |
371 &pending_exception); | 388 &pending_exception); |
372 ASSERT(Top::has_pending_exception() == pending_exception); | 389 ASSERT(Top::has_pending_exception() == pending_exception); |
373 if (pending_exception) return Failure::Exception(); | 390 if (pending_exception) return Failure::Exception(); |
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
731 if (entry->contains(pc)) { | 748 if (entry->contains(pc)) { |
732 return names_[i]; | 749 return names_[i]; |
733 } | 750 } |
734 } | 751 } |
735 } | 752 } |
736 return NULL; | 753 return NULL; |
737 } | 754 } |
738 | 755 |
739 | 756 |
740 } } // namespace v8::internal | 757 } } // namespace v8::internal |
OLD | NEW |