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

Side by Side Diff: src/builtins.cc

Issue 7223: Introduce a special kind of frames for construct frames, e.g.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 12 years, 2 months 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/builtins.h ('k') | src/builtins-arm.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-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
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
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
OLDNEW
« no previous file with comments | « src/builtins.h ('k') | src/builtins-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698