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

Side by Side Diff: src/api.cc

Issue 99254: Add the "arguments" global to the shell sample. The "arguments"... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 7 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 | « samples/shell.cc ('k') | src/d8.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 2009 the V8 project authors. All rights reserved. 1 // Copyright 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 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 254
255 void V8::SetFlagsFromString(const char* str, int length) { 255 void V8::SetFlagsFromString(const char* str, int length) {
256 i::FlagList::SetFlagsFromString(str, length); 256 i::FlagList::SetFlagsFromString(str, length);
257 } 257 }
258 258
259 259
260 void V8::SetFlagsFromCommandLine(int* argc, char** argv, bool remove_flags) { 260 void V8::SetFlagsFromCommandLine(int* argc, char** argv, bool remove_flags) {
261 i::FlagList::SetFlagsFromCommandLine(argc, argv, remove_flags); 261 i::FlagList::SetFlagsFromCommandLine(argc, argv, remove_flags);
262 } 262 }
263 263
264 Local<Array> V8::GetJSArguments() {
265 i::JSArguments js_args = i::FLAG_js_arguments;
266 i::Handle<i::FixedArray> arguments_array =
267 i::Factory::NewFixedArray(js_args.argc());
268 for (int j = 0; j < js_args.argc(); j++) {
269 i::Handle<i::String> arg =
270 i::Factory::NewStringFromUtf8(i::CStrVector(js_args[j]));
271 arguments_array->set(j, *arg);
272 }
273 i::Handle<i::JSArray> arguments_jsarray =
274 i::Factory::NewJSArrayWithElements(arguments_array);
275 return Utils::ToLocal(arguments_jsarray);
276 }
264 277
265 v8::Handle<Value> ThrowException(v8::Handle<v8::Value> value) { 278 v8::Handle<Value> ThrowException(v8::Handle<v8::Value> value) {
266 if (IsDeadCheck("v8::ThrowException()")) return v8::Handle<Value>(); 279 if (IsDeadCheck("v8::ThrowException()")) return v8::Handle<Value>();
267 ENTER_V8; 280 ENTER_V8;
268 // If we're passed an empty handle, we throw an undefined exception 281 // If we're passed an empty handle, we throw an undefined exception
269 // to deal more gracefully with out of memory situations. 282 // to deal more gracefully with out of memory situations.
270 if (value.IsEmpty()) { 283 if (value.IsEmpty()) {
271 i::Top::ScheduleThrow(i::Heap::undefined_value()); 284 i::Top::ScheduleThrow(i::Heap::undefined_value());
272 } else { 285 } else {
273 i::Top::ScheduleThrow(*Utils::OpenHandle(*value)); 286 i::Top::ScheduleThrow(*Utils::OpenHandle(*value));
(...skipping 3145 matching lines...) Expand 10 before | Expand all | Expand 10 after
3419 reinterpret_cast<HandleScopeImplementer*>(storage); 3432 reinterpret_cast<HandleScopeImplementer*>(storage);
3420 List<void**>* blocks_of_archived_thread = thread_local->Blocks(); 3433 List<void**>* blocks_of_archived_thread = thread_local->Blocks();
3421 v8::ImplementationUtilities::HandleScopeData* handle_data_of_archived_thread = 3434 v8::ImplementationUtilities::HandleScopeData* handle_data_of_archived_thread =
3422 &thread_local->handle_scope_data_; 3435 &thread_local->handle_scope_data_;
3423 Iterate(v, blocks_of_archived_thread, handle_data_of_archived_thread); 3436 Iterate(v, blocks_of_archived_thread, handle_data_of_archived_thread);
3424 3437
3425 return storage + ArchiveSpacePerThread(); 3438 return storage + ArchiveSpacePerThread();
3426 } 3439 }
3427 3440
3428 } } // namespace v8::internal 3441 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « samples/shell.cc ('k') | src/d8.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698