| 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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 | 87 |
| 88 | 88 |
| 89 // TODO(1238487): Get rid of this function that determines if the | 89 // TODO(1238487): Get rid of this function that determines if the |
| 90 // builtin is called as a constructor. This may be a somewhat slow | 90 // builtin is called as a constructor. This may be a somewhat slow |
| 91 // operation due to the stack frame iteration. | 91 // operation due to the stack frame iteration. |
| 92 static inline bool CalledAsConstructor() { | 92 static inline bool CalledAsConstructor() { |
| 93 StackFrameIterator it; | 93 StackFrameIterator it; |
| 94 ASSERT(it.frame()->is_exit()); | 94 ASSERT(it.frame()->is_exit()); |
| 95 it.Advance(); | 95 it.Advance(); |
| 96 StackFrame* frame = it.frame(); | 96 StackFrame* frame = it.frame(); |
| 97 return frame->is_internal() && | 97 return frame->is_construct(); |
| 98 InternalFrame::cast(frame)->is_construct_trampoline(); | |
| 99 } | 98 } |
| 100 | 99 |
| 101 | 100 |
| 102 // ---------------------------------------------------------------------------- | 101 // ---------------------------------------------------------------------------- |
| 103 | 102 |
| 104 | 103 |
| 105 int Builtins::construct_call_pc_offset_ = 0; | |
| 106 int Builtins::arguments_adaptor_call_pc_offset_ = 0; | |
| 107 | |
| 108 | |
| 109 // Check if the builtin was called in a 'new' call. | |
| 110 bool Builtins::IsConstructCall(Address pc) { | |
| 111 ASSERT(construct_call_pc_offset_ > 0); | |
| 112 int offset = pc - builtin(JSConstructCall)->address(); | |
| 113 return offset == construct_call_pc_offset_; | |
| 114 } | |
| 115 | |
| 116 | |
| 117 bool Builtins::IsArgumentsAdaptorCall(Address pc) { | |
| 118 ASSERT(arguments_adaptor_call_pc_offset_ > 0); | |
| 119 int offset = pc - builtin(ArgumentsAdaptorTrampoline)->address(); | |
| 120 return offset == arguments_adaptor_call_pc_offset_; | |
| 121 } | |
| 122 | |
| 123 | |
| 124 Handle<Code> Builtins::GetCode(JavaScript id, bool* resolved) { | 104 Handle<Code> Builtins::GetCode(JavaScript id, bool* resolved) { |
| 125 Code* code = Builtins::builtin(Builtins::Illegal); | 105 Code* code = Builtins::builtin(Builtins::Illegal); |
| 126 *resolved = false; | 106 *resolved = false; |
| 127 | 107 |
| 128 if (Top::security_context() != NULL) { | 108 if (Top::security_context() != NULL) { |
| 129 Object* object = Top::security_context_builtins()->javascript_builtin(id); | 109 Object* object = Top::security_context_builtins()->javascript_builtin(id); |
| 130 if (object->IsJSFunction()) { | 110 if (object->IsJSFunction()) { |
| 131 Handle<JSFunction> function(JSFunction::cast(object)); | 111 Handle<JSFunction> function(JSFunction::cast(object)); |
| 132 // Make sure the number of parameters match the formal parameter count. | 112 // Make sure the number of parameters match the formal parameter count. |
| 133 ASSERT(function->shared()->formal_parameter_count() == | 113 ASSERT(function->shared()->formal_parameter_count() == |
| (...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 726 if (entry->contains(pc)) { | 706 if (entry->contains(pc)) { |
| 727 return names_[i]; | 707 return names_[i]; |
| 728 } | 708 } |
| 729 } | 709 } |
| 730 } | 710 } |
| 731 return NULL; | 711 return NULL; |
| 732 } | 712 } |
| 733 | 713 |
| 734 | 714 |
| 735 } } // namespace v8::internal | 715 } } // namespace v8::internal |
| OLD | NEW |