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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 | 146 |
147 Handle<AccessorInfo> Factory::NewAccessorInfo() { | 147 Handle<AccessorInfo> Factory::NewAccessorInfo() { |
148 Handle<AccessorInfo> info = | 148 Handle<AccessorInfo> info = |
149 Handle<AccessorInfo>::cast(NewStruct(ACCESSOR_INFO_TYPE)); | 149 Handle<AccessorInfo>::cast(NewStruct(ACCESSOR_INFO_TYPE)); |
150 info->set_flag(0); // Must clear the flag, it was initialized as undefined. | 150 info->set_flag(0); // Must clear the flag, it was initialized as undefined. |
151 return info; | 151 return info; |
152 } | 152 } |
153 | 153 |
154 | 154 |
155 Handle<Script> Factory::NewScript(Handle<String> source) { | 155 Handle<Script> Factory::NewScript(Handle<String> source) { |
| 156 static uint32_t next_id = 1; |
| 157 |
156 Handle<Script> script = Handle<Script>::cast(NewStruct(SCRIPT_TYPE)); | 158 Handle<Script> script = Handle<Script>::cast(NewStruct(SCRIPT_TYPE)); |
157 script->set_source(*source); | 159 script->set_source(*source); |
158 script->set_name(Heap::undefined_value()); | 160 script->set_name(Heap::undefined_value()); |
| 161 script->set_id(*Factory::NewNumberFromUint(next_id++)); |
159 script->set_line_offset(Smi::FromInt(0)); | 162 script->set_line_offset(Smi::FromInt(0)); |
160 script->set_column_offset(Smi::FromInt(0)); | 163 script->set_column_offset(Smi::FromInt(0)); |
161 script->set_type(Smi::FromInt(SCRIPT_TYPE_NORMAL)); | 164 script->set_type(Smi::FromInt(SCRIPT_TYPE_NORMAL)); |
162 script->set_wrapper(*Factory::NewProxy(0, TENURED)); | 165 script->set_wrapper(*Factory::NewProxy(0, TENURED)); |
163 script->set_line_ends(Heap::undefined_value()); | 166 script->set_line_ends(Heap::undefined_value()); |
164 return script; | 167 return script; |
165 } | 168 } |
166 | 169 |
167 | 170 |
168 Handle<Proxy> Factory::NewProxy(Address addr, PretenureFlag pretenure) { | 171 Handle<Proxy> Factory::NewProxy(Address addr, PretenureFlag pretenure) { |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 PretenureFlag pretenure) { | 273 PretenureFlag pretenure) { |
271 CALL_HEAP_FUNCTION(Heap::NumberFromDouble(value, pretenure), Object); | 274 CALL_HEAP_FUNCTION(Heap::NumberFromDouble(value, pretenure), Object); |
272 } | 275 } |
273 | 276 |
274 | 277 |
275 Handle<Object> Factory::NewNumberFromInt(int value) { | 278 Handle<Object> Factory::NewNumberFromInt(int value) { |
276 CALL_HEAP_FUNCTION(Heap::NumberFromInt32(value), Object); | 279 CALL_HEAP_FUNCTION(Heap::NumberFromInt32(value), Object); |
277 } | 280 } |
278 | 281 |
279 | 282 |
| 283 Handle<Object> Factory::NewNumberFromUint(uint32_t value) { |
| 284 CALL_HEAP_FUNCTION(Heap::NumberFromUint32(value), Object); |
| 285 } |
| 286 |
| 287 |
280 Handle<JSObject> Factory::NewNeanderObject() { | 288 Handle<JSObject> Factory::NewNeanderObject() { |
281 CALL_HEAP_FUNCTION(Heap::AllocateJSObjectFromMap(Heap::neander_map()), | 289 CALL_HEAP_FUNCTION(Heap::AllocateJSObjectFromMap(Heap::neander_map()), |
282 JSObject); | 290 JSObject); |
283 } | 291 } |
284 | 292 |
285 | 293 |
286 Handle<Object> Factory::NewTypeError(const char* type, | 294 Handle<Object> Factory::NewTypeError(const char* type, |
287 Vector< Handle<Object> > args) { | 295 Vector< Handle<Object> > args) { |
288 return NewError("MakeTypeError", type, args); | 296 return NewError("MakeTypeError", type, args); |
289 } | 297 } |
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
852 Execution::ConfigureInstance(instance, | 860 Execution::ConfigureInstance(instance, |
853 instance_template, | 861 instance_template, |
854 pending_exception); | 862 pending_exception); |
855 } else { | 863 } else { |
856 *pending_exception = false; | 864 *pending_exception = false; |
857 } | 865 } |
858 } | 866 } |
859 | 867 |
860 | 868 |
861 } } // namespace v8::internal | 869 } } // namespace v8::internal |
OLD | NEW |