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

Side by Side Diff: src/d8.cc

Issue 11417029: Drastically reduce the number of created strings in d8. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed feedback Created 8 years, 1 month 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 #if !defined(_WIN32) && !defined(_WIN64) 60 #if !defined(_WIN32) && !defined(_WIN64)
61 #include <unistd.h> // NOLINT 61 #include <unistd.h> // NOLINT
62 #endif 62 #endif
63 63
64 #ifndef ASSERT 64 #ifndef ASSERT
65 #define ASSERT(condition) assert(condition) 65 #define ASSERT(condition) assert(condition)
66 #endif 66 #endif
67 67
68 namespace v8 { 68 namespace v8 {
69 69
70
71 static Handle<Value> Throw(const char* message) {
72 return ThrowException(String::New(message));
73 }
74
75
76 // TODO(rossberg): should replace these by proper uses of HasInstance,
77 // once we figure out a good way to make the templates global.
78 const char kArrayBufferMarkerPropName[] = "d8::_is_array_buffer_";
79 const char kArrayMarkerPropName[] = "d8::_is_typed_array_";
80
81
82 namespace Symbols {
83 #define FOR_EACH_SYMBOL(V) \
84 V(ArrayBuffer, "ArrayBuffer") \
85 V(ArrayBufferMarkerPropName, kArrayBufferMarkerPropName) \
86 V(ArrayMarkerPropName, kArrayMarkerPropName) \
87 V(buffer, "buffer") \
88 V(byteLength, "byteLength") \
89 V(byteOffset, "byteOffset") \
90 V(BYTES_PER_ELEMENT, "BYTES_PER_ELEMENT") \
91 V(length, "length")
92
93 #define DEFINE_SYMBOL(name, value) Persistent<String> name;
94 FOR_EACH_SYMBOL(DEFINE_SYMBOL)
95 #undef DEFINE_SYMBOL
96
97 void Initialize() {
98 HandleScope scope;
99 #define INIT_SYMBOL(name, value) \
100 name = Persistent<String>::New(String::NewSymbol(value));
101 FOR_EACH_SYMBOL(INIT_SYMBOL)
102 #undef INIT_SYMBOL
103 }
104
105 void TearDown() {
106 #define DISPOSE_SYMBOL(name, value) name.Dispose();
107 FOR_EACH_SYMBOL(DISPOSE_SYMBOL)
108 #undef DISPOSE_SYMBOL
109 }
110 }
111
112
70 LineEditor *LineEditor::first_ = NULL; 113 LineEditor *LineEditor::first_ = NULL;
71 114
72 115
73 LineEditor::LineEditor(Type type, const char* name) 116 LineEditor::LineEditor(Type type, const char* name)
74 : type_(type), 117 : type_(type),
75 name_(name), 118 name_(name),
76 next_(first_) { 119 next_(first_) {
77 first_ = this; 120 first_ = this;
78 } 121 }
79 122
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 268
226 Handle<Value> Shell::DisableProfiler(const Arguments& args) { 269 Handle<Value> Shell::DisableProfiler(const Arguments& args) {
227 V8::PauseProfiler(); 270 V8::PauseProfiler();
228 return Undefined(); 271 return Undefined();
229 } 272 }
230 273
231 274
232 Handle<Value> Shell::Read(const Arguments& args) { 275 Handle<Value> Shell::Read(const Arguments& args) {
233 String::Utf8Value file(args[0]); 276 String::Utf8Value file(args[0]);
234 if (*file == NULL) { 277 if (*file == NULL) {
235 return ThrowException(String::New("Error loading file")); 278 return Throw("Error loading file");
236 } 279 }
237 Handle<String> source = ReadFile(*file); 280 Handle<String> source = ReadFile(*file);
238 if (source.IsEmpty()) { 281 if (source.IsEmpty()) {
239 return ThrowException(String::New("Error loading file")); 282 return Throw("Error loading file");
240 } 283 }
241 return source; 284 return source;
242 } 285 }
243 286
244 287
245 Handle<String> Shell::ReadFromStdin() { 288 Handle<String> Shell::ReadFromStdin() {
246 static const int kBufferSize = 256; 289 static const int kBufferSize = 256;
247 char buffer[kBufferSize]; 290 char buffer[kBufferSize];
248 Handle<String> accumulator = String::New(""); 291 Handle<String> accumulator = String::New("");
249 int length; 292 int length;
(...skipping 20 matching lines...) Expand all
270 } 313 }
271 } 314 }
272 } 315 }
273 316
274 317
275 Handle<Value> Shell::Load(const Arguments& args) { 318 Handle<Value> Shell::Load(const Arguments& args) {
276 for (int i = 0; i < args.Length(); i++) { 319 for (int i = 0; i < args.Length(); i++) {
277 HandleScope handle_scope; 320 HandleScope handle_scope;
278 String::Utf8Value file(args[i]); 321 String::Utf8Value file(args[i]);
279 if (*file == NULL) { 322 if (*file == NULL) {
280 return ThrowException(String::New("Error loading file")); 323 return Throw("Error loading file");
281 } 324 }
282 Handle<String> source = ReadFile(*file); 325 Handle<String> source = ReadFile(*file);
283 if (source.IsEmpty()) { 326 if (source.IsEmpty()) {
284 return ThrowException(String::New("Error loading file")); 327 return Throw("Error loading file");
285 } 328 }
286 if (!ExecuteString(source, String::New(*file), false, true)) { 329 if (!ExecuteString(source, String::New(*file), false, true)) {
287 return ThrowException(String::New("Error executing file")); 330 return Throw("Error executing file");
288 } 331 }
289 } 332 }
290 return Undefined(); 333 return Undefined();
291 } 334 }
292 335
293 static int32_t convertToInt(Local<Value> value_in, TryCatch* try_catch) { 336 static int32_t convertToInt(Local<Value> value_in, TryCatch* try_catch) {
294 if (value_in->IsInt32()) { 337 if (value_in->IsInt32()) {
295 return value_in->Int32Value(); 338 return value_in->Int32Value();
296 } 339 }
297 340
298 Local<Value> number = value_in->ToNumber(); 341 Local<Value> number = value_in->ToNumber();
299 if (try_catch->HasCaught()) return 0; 342 if (try_catch->HasCaught()) return 0;
300 343
301 ASSERT(number->IsNumber()); 344 ASSERT(number->IsNumber());
302 Local<Int32> int32 = number->ToInt32(); 345 Local<Int32> int32 = number->ToInt32();
303 if (try_catch->HasCaught() || int32.IsEmpty()) return 0; 346 if (try_catch->HasCaught() || int32.IsEmpty()) return 0;
304 347
305 int32_t value = int32->Int32Value(); 348 int32_t value = int32->Int32Value();
306 if (try_catch->HasCaught()) return 0; 349 if (try_catch->HasCaught()) return 0;
307 350
308 return value; 351 return value;
309 } 352 }
310 353
311 354
312 static int32_t convertToUint(Local<Value> value_in, TryCatch* try_catch) { 355 static int32_t convertToUint(Local<Value> value_in, TryCatch* try_catch) {
313 int32_t raw_value = convertToInt(value_in, try_catch); 356 int32_t raw_value = convertToInt(value_in, try_catch);
314 if (try_catch->HasCaught()) return 0; 357 if (try_catch->HasCaught()) return 0;
315 358
316 if (raw_value < 0) { 359 if (raw_value < 0) {
317 ThrowException(String::New("Array length must not be negative.")); 360 Throw("Array length must not be negative.");
318 return 0; 361 return 0;
319 } 362 }
320 363
321 static const int kMaxLength = 0x3fffffff; 364 static const int kMaxLength = 0x3fffffff;
322 #ifndef V8_SHARED 365 #ifndef V8_SHARED
323 ASSERT(kMaxLength == i::ExternalArray::kMaxLength); 366 ASSERT(kMaxLength == i::ExternalArray::kMaxLength);
324 #endif // V8_SHARED 367 #endif // V8_SHARED
325 if (raw_value > static_cast<int32_t>(kMaxLength)) { 368 if (raw_value > static_cast<int32_t>(kMaxLength)) {
326 ThrowException( 369 Throw("Array length exceeds maximum length.");
327 String::New("Array length exceeds maximum length."));
328 } 370 }
329 return raw_value; 371 return raw_value;
330 } 372 }
331 373
332 374
333 // TODO(rossberg): should replace these by proper uses of HasInstance,
334 // once we figure out a good way to make the templates global.
335 const char kArrayBufferMarkerPropName[] = "d8::_is_array_buffer_";
336 const char kArrayMarkerPropName[] = "d8::_is_typed_array_";
337
338
339 Handle<Value> Shell::CreateExternalArrayBuffer(Handle<Object> buffer, 375 Handle<Value> Shell::CreateExternalArrayBuffer(Handle<Object> buffer,
340 int32_t length) { 376 int32_t length) {
341 static const int32_t kMaxSize = 0x7fffffff; 377 static const int32_t kMaxSize = 0x7fffffff;
342 // Make sure the total size fits into a (signed) int. 378 // Make sure the total size fits into a (signed) int.
343 if (length < 0 || length > kMaxSize) { 379 if (length < 0 || length > kMaxSize) {
344 return ThrowException(String::New("ArrayBuffer exceeds maximum size (2G)")); 380 return Throw("ArrayBuffer exceeds maximum size (2G)");
345 } 381 }
346 uint8_t* data = new uint8_t[length]; 382 uint8_t* data = new uint8_t[length];
347 if (data == NULL) { 383 if (data == NULL) {
348 return ThrowException(String::New("Memory allocation failed")); 384 return Throw("Memory allocation failed");
349 } 385 }
350 memset(data, 0, length); 386 memset(data, 0, length);
351 387
352 buffer->SetHiddenValue(String::New(kArrayBufferMarkerPropName), True()); 388 buffer->SetHiddenValue(Symbols::ArrayBufferMarkerPropName, True());
353 Persistent<Object> persistent_array = Persistent<Object>::New(buffer); 389 Persistent<Object> persistent_array = Persistent<Object>::New(buffer);
354 persistent_array.MakeWeak(data, ExternalArrayWeakCallback); 390 persistent_array.MakeWeak(data, ExternalArrayWeakCallback);
355 persistent_array.MarkIndependent(); 391 persistent_array.MarkIndependent();
356 V8::AdjustAmountOfExternalAllocatedMemory(length); 392 V8::AdjustAmountOfExternalAllocatedMemory(length);
357 393
358 buffer->SetIndexedPropertiesToExternalArrayData( 394 buffer->SetIndexedPropertiesToExternalArrayData(
359 data, v8::kExternalByteArray, length); 395 data, v8::kExternalByteArray, length);
360 buffer->Set(String::New("byteLength"), Int32::New(length), ReadOnly); 396 buffer->Set(Symbols::byteLength, Int32::New(length), ReadOnly);
361 397
362 return buffer; 398 return buffer;
363 } 399 }
364 400
365 401
366 Handle<Value> Shell::ArrayBuffer(const Arguments& args) { 402 Handle<Value> Shell::ArrayBuffer(const Arguments& args) {
367 if (!args.IsConstructCall()) { 403 if (!args.IsConstructCall()) {
368 Handle<Value>* rec_args = new Handle<Value>[args.Length()]; 404 Handle<Value>* rec_args = new Handle<Value>[args.Length()];
369 for (int i = 0; i < args.Length(); ++i) rec_args[i] = args[i]; 405 for (int i = 0; i < args.Length(); ++i) rec_args[i] = args[i];
370 Handle<Value> result = args.Callee()->NewInstance(args.Length(), rec_args); 406 Handle<Value> result = args.Callee()->NewInstance(args.Length(), rec_args);
371 delete[] rec_args; 407 delete[] rec_args;
372 return result; 408 return result;
373 } 409 }
374 410
375 if (args.Length() == 0) { 411 if (args.Length() == 0) {
376 return ThrowException( 412 return Throw("ArrayBuffer constructor must have one argument");
377 String::New("ArrayBuffer constructor must have one argument"));
378 } 413 }
379 TryCatch try_catch; 414 TryCatch try_catch;
380 int32_t length = convertToUint(args[0], &try_catch); 415 int32_t length = convertToUint(args[0], &try_catch);
381 if (try_catch.HasCaught()) return try_catch.ReThrow(); 416 if (try_catch.HasCaught()) return try_catch.ReThrow();
382 417
383 return CreateExternalArrayBuffer(args.This(), length); 418 return CreateExternalArrayBuffer(args.This(), length);
384 } 419 }
385 420
386 421
387 Handle<Object> Shell::CreateExternalArray(Handle<Object> array, 422 Handle<Object> Shell::CreateExternalArray(Handle<Object> array,
388 Handle<Object> buffer, 423 Handle<Object> buffer,
389 ExternalArrayType type, 424 ExternalArrayType type,
390 int32_t length, 425 int32_t length,
391 int32_t byteLength, 426 int32_t byteLength,
392 int32_t byteOffset, 427 int32_t byteOffset,
393 int32_t element_size) { 428 int32_t element_size) {
394 ASSERT(element_size == 1 || element_size == 2 || 429 ASSERT(element_size == 1 || element_size == 2 ||
395 element_size == 4 || element_size == 8); 430 element_size == 4 || element_size == 8);
396 ASSERT(byteLength == length * element_size); 431 ASSERT(byteLength == length * element_size);
397 432
398 void* data = buffer->GetIndexedPropertiesExternalArrayData(); 433 void* data = buffer->GetIndexedPropertiesExternalArrayData();
399 ASSERT(data != NULL); 434 ASSERT(data != NULL);
400 435
401 array->SetIndexedPropertiesToExternalArrayData( 436 array->SetIndexedPropertiesToExternalArrayData(
402 static_cast<uint8_t*>(data) + byteOffset, type, length); 437 static_cast<uint8_t*>(data) + byteOffset, type, length);
403 array->SetHiddenValue(String::New(kArrayMarkerPropName), Int32::New(type)); 438 array->SetHiddenValue(Symbols::ArrayMarkerPropName, Int32::New(type));
404 array->Set(String::New("byteLength"), Int32::New(byteLength), ReadOnly); 439 array->Set(Symbols::byteLength, Int32::New(byteLength), ReadOnly);
405 array->Set(String::New("byteOffset"), Int32::New(byteOffset), ReadOnly); 440 array->Set(Symbols::byteOffset, Int32::New(byteOffset), ReadOnly);
406 array->Set(String::New("length"), Int32::New(length), ReadOnly); 441 array->Set(Symbols::length, Int32::New(length), ReadOnly);
407 array->Set(String::New("BYTES_PER_ELEMENT"), Int32::New(element_size)); 442 array->Set(Symbols::BYTES_PER_ELEMENT, Int32::New(element_size));
408 array->Set(String::New("buffer"), buffer, ReadOnly); 443 array->Set(Symbols::buffer, buffer, ReadOnly);
409 444
410 return array; 445 return array;
411 } 446 }
412 447
413 448
414 Handle<Value> Shell::CreateExternalArray(const Arguments& args, 449 Handle<Value> Shell::CreateExternalArray(const Arguments& args,
415 ExternalArrayType type, 450 ExternalArrayType type,
416 int32_t element_size) { 451 int32_t element_size) {
417 if (!args.IsConstructCall()) { 452 if (!args.IsConstructCall()) {
418 Handle<Value>* rec_args = new Handle<Value>[args.Length()]; 453 Handle<Value>* rec_args = new Handle<Value>[args.Length()];
(...skipping 13 matching lines...) Expand all
432 // TypedArray(TypedArray array) 467 // TypedArray(TypedArray array)
433 // TypedArray(ArrayBuffer buffer, 468 // TypedArray(ArrayBuffer buffer,
434 // optional unsigned long byteOffset, 469 // optional unsigned long byteOffset,
435 // optional unsigned long length) 470 // optional unsigned long length)
436 Handle<Object> buffer; 471 Handle<Object> buffer;
437 int32_t length; 472 int32_t length;
438 int32_t byteLength; 473 int32_t byteLength;
439 int32_t byteOffset; 474 int32_t byteOffset;
440 bool init_from_array = false; 475 bool init_from_array = false;
441 if (args.Length() == 0) { 476 if (args.Length() == 0) {
442 return ThrowException( 477 return Throw("Array constructor must have at least one argument");
443 String::New("Array constructor must have at least one argument"));
444 } 478 }
445 if (args[0]->IsObject() && 479 if (args[0]->IsObject() &&
446 !args[0]->ToObject()->GetHiddenValue( 480 !args[0]->ToObject()->GetHiddenValue(
447 String::New(kArrayBufferMarkerPropName)).IsEmpty()) { 481 Symbols::ArrayBufferMarkerPropName).IsEmpty()) {
448 // Construct from ArrayBuffer. 482 // Construct from ArrayBuffer.
449 buffer = args[0]->ToObject(); 483 buffer = args[0]->ToObject();
450 int32_t bufferLength = 484 int32_t bufferLength =
451 convertToUint(buffer->Get(String::New("byteLength")), &try_catch); 485 convertToUint(buffer->Get(Symbols::byteLength), &try_catch);
452 if (try_catch.HasCaught()) return try_catch.ReThrow(); 486 if (try_catch.HasCaught()) return try_catch.ReThrow();
453 487
454 if (args.Length() < 2 || args[1]->IsUndefined()) { 488 if (args.Length() < 2 || args[1]->IsUndefined()) {
455 byteOffset = 0; 489 byteOffset = 0;
456 } else { 490 } else {
457 byteOffset = convertToUint(args[1], &try_catch); 491 byteOffset = convertToUint(args[1], &try_catch);
458 if (try_catch.HasCaught()) return try_catch.ReThrow(); 492 if (try_catch.HasCaught()) return try_catch.ReThrow();
459 if (byteOffset > bufferLength) { 493 if (byteOffset > bufferLength) {
460 return ThrowException(String::New("byteOffset out of bounds")); 494 return Throw("byteOffset out of bounds");
461 } 495 }
462 if (byteOffset % element_size != 0) { 496 if (byteOffset % element_size != 0) {
463 return ThrowException( 497 return Throw("byteOffset must be multiple of element size");
464 String::New("byteOffset must be multiple of element size"));
465 } 498 }
466 } 499 }
467 500
468 if (args.Length() < 3 || args[2]->IsUndefined()) { 501 if (args.Length() < 3 || args[2]->IsUndefined()) {
469 byteLength = bufferLength - byteOffset; 502 byteLength = bufferLength - byteOffset;
470 length = byteLength / element_size; 503 length = byteLength / element_size;
471 if (byteLength % element_size != 0) { 504 if (byteLength % element_size != 0) {
472 return ThrowException( 505 return Throw("buffer size must be multiple of element size");
473 String::New("buffer size must be multiple of element size"));
474 } 506 }
475 } else { 507 } else {
476 length = convertToUint(args[2], &try_catch); 508 length = convertToUint(args[2], &try_catch);
477 if (try_catch.HasCaught()) return try_catch.ReThrow(); 509 if (try_catch.HasCaught()) return try_catch.ReThrow();
478 byteLength = length * element_size; 510 byteLength = length * element_size;
479 if (byteOffset + byteLength > bufferLength) { 511 if (byteOffset + byteLength > bufferLength) {
480 return ThrowException(String::New("length out of bounds")); 512 return Throw("length out of bounds");
481 } 513 }
482 } 514 }
483 } else { 515 } else {
484 if (args[0]->IsObject() && 516 if (args[0]->IsObject() &&
485 args[0]->ToObject()->Has(String::New("length"))) { 517 args[0]->ToObject()->Has(Symbols::length)) {
486 // Construct from array. 518 // Construct from array.
487 length = convertToUint( 519 length = convertToUint(
488 args[0]->ToObject()->Get(String::New("length")), &try_catch); 520 args[0]->ToObject()->Get(Symbols::length), &try_catch);
489 if (try_catch.HasCaught()) return try_catch.ReThrow(); 521 if (try_catch.HasCaught()) return try_catch.ReThrow();
490 init_from_array = true; 522 init_from_array = true;
491 } else { 523 } else {
492 // Construct from size. 524 // Construct from size.
493 length = convertToUint(args[0], &try_catch); 525 length = convertToUint(args[0], &try_catch);
494 if (try_catch.HasCaught()) return try_catch.ReThrow(); 526 if (try_catch.HasCaught()) return try_catch.ReThrow();
495 } 527 }
496 byteLength = length * element_size; 528 byteLength = length * element_size;
497 byteOffset = 0; 529 byteOffset = 0;
498 530
499 Handle<Object> global = Context::GetCurrent()->Global(); 531 Handle<Object> global = Context::GetCurrent()->Global();
500 Handle<Value> array_buffer = global->Get(String::New("ArrayBuffer")); 532 Handle<Value> array_buffer = global->Get(Symbols::ArrayBuffer);
501 ASSERT(!try_catch.HasCaught() && array_buffer->IsFunction()); 533 ASSERT(!try_catch.HasCaught() && array_buffer->IsFunction());
502 Handle<Value> buffer_args[] = { Uint32::New(byteLength) }; 534 Handle<Value> buffer_args[] = { Uint32::New(byteLength) };
503 Handle<Value> result = Handle<Function>::Cast(array_buffer)->NewInstance( 535 Handle<Value> result = Handle<Function>::Cast(array_buffer)->NewInstance(
504 1, buffer_args); 536 1, buffer_args);
505 if (try_catch.HasCaught()) return result; 537 if (try_catch.HasCaught()) return result;
506 buffer = result->ToObject(); 538 buffer = result->ToObject();
507 } 539 }
508 540
509 Handle<Object> array = CreateExternalArray( 541 Handle<Object> array = CreateExternalArray(
510 args.This(), buffer, type, length, byteLength, byteOffset, element_size); 542 args.This(), buffer, type, length, byteLength, byteOffset, element_size);
511 543
512 if (init_from_array) { 544 if (init_from_array) {
513 Handle<Object> init = args[0]->ToObject(); 545 Handle<Object> init = args[0]->ToObject();
514 for (int i = 0; i < length; ++i) array->Set(i, init->Get(i)); 546 for (int i = 0; i < length; ++i) array->Set(i, init->Get(i));
515 } 547 }
516 548
517 return array; 549 return array;
518 } 550 }
519 551
520 552
521 Handle<Value> Shell::ArrayBufferSlice(const Arguments& args) { 553 Handle<Value> Shell::ArrayBufferSlice(const Arguments& args) {
522 TryCatch try_catch; 554 TryCatch try_catch;
523 555
524 if (!args.This()->IsObject()) { 556 if (!args.This()->IsObject()) {
525 return ThrowException( 557 return Throw("'slice' invoked on non-object receiver");
526 String::New("'slice' invoked on non-object receiver"));
527 } 558 }
528 559
529 Local<Object> self = args.This(); 560 Local<Object> self = args.This();
530 Local<Value> marker = 561 Local<Value> marker =
531 self->GetHiddenValue(String::New(kArrayBufferMarkerPropName)); 562 self->GetHiddenValue(Symbols::ArrayBufferMarkerPropName);
532 if (marker.IsEmpty()) { 563 if (marker.IsEmpty()) {
533 return ThrowException( 564 return Throw("'slice' invoked on wrong receiver type");
534 String::New("'slice' invoked on wrong receiver type"));
535 } 565 }
536 566
537 int32_t length = 567 int32_t length =
538 convertToUint(self->Get(String::New("byteLength")), &try_catch); 568 convertToUint(self->Get(Symbols::byteLength), &try_catch);
539 if (try_catch.HasCaught()) return try_catch.ReThrow(); 569 if (try_catch.HasCaught()) return try_catch.ReThrow();
540 570
541 if (args.Length() == 0) { 571 if (args.Length() == 0) {
542 return ThrowException( 572 return Throw("'slice' must have at least one argument");
543 String::New("'slice' must have at least one argument"));
544 } 573 }
545 int32_t begin = convertToInt(args[0], &try_catch); 574 int32_t begin = convertToInt(args[0], &try_catch);
546 if (try_catch.HasCaught()) return try_catch.ReThrow(); 575 if (try_catch.HasCaught()) return try_catch.ReThrow();
547 if (begin < 0) begin += length; 576 if (begin < 0) begin += length;
548 if (begin < 0) begin = 0; 577 if (begin < 0) begin = 0;
549 if (begin > length) begin = length; 578 if (begin > length) begin = length;
550 579
551 int32_t end; 580 int32_t end;
552 if (args.Length() < 2 || args[1]->IsUndefined()) { 581 if (args.Length() < 2 || args[1]->IsUndefined()) {
553 end = length; 582 end = length;
(...skipping 18 matching lines...) Expand all
572 memcpy(dest, src, end - begin); 601 memcpy(dest, src, end - begin);
573 602
574 return buffer; 603 return buffer;
575 } 604 }
576 605
577 606
578 Handle<Value> Shell::ArraySubArray(const Arguments& args) { 607 Handle<Value> Shell::ArraySubArray(const Arguments& args) {
579 TryCatch try_catch; 608 TryCatch try_catch;
580 609
581 if (!args.This()->IsObject()) { 610 if (!args.This()->IsObject()) {
582 return ThrowException( 611 return Throw("'subarray' invoked on non-object receiver");
583 String::New("'subarray' invoked on non-object receiver"));
584 } 612 }
585 613
586 Local<Object> self = args.This(); 614 Local<Object> self = args.This();
587 Local<Value> marker = self->GetHiddenValue(String::New(kArrayMarkerPropName)); 615 Local<Value> marker = self->GetHiddenValue(Symbols::ArrayMarkerPropName);
588 if (marker.IsEmpty()) { 616 if (marker.IsEmpty()) {
589 return ThrowException( 617 return Throw("'subarray' invoked on wrong receiver type");
590 String::New("'subarray' invoked on wrong receiver type"));
591 } 618 }
592 619
593 Handle<Object> buffer = self->Get(String::New("buffer"))->ToObject(); 620 Handle<Object> buffer = self->Get(Symbols::buffer)->ToObject();
594 if (try_catch.HasCaught()) return try_catch.ReThrow(); 621 if (try_catch.HasCaught()) return try_catch.ReThrow();
595 int32_t length = 622 int32_t length =
596 convertToUint(self->Get(String::New("length")), &try_catch); 623 convertToUint(self->Get(Symbols::length), &try_catch);
597 if (try_catch.HasCaught()) return try_catch.ReThrow(); 624 if (try_catch.HasCaught()) return try_catch.ReThrow();
598 int32_t byteOffset = 625 int32_t byteOffset =
599 convertToUint(self->Get(String::New("byteOffset")), &try_catch); 626 convertToUint(self->Get(Symbols::byteOffset), &try_catch);
600 if (try_catch.HasCaught()) return try_catch.ReThrow(); 627 if (try_catch.HasCaught()) return try_catch.ReThrow();
601 int32_t element_size = 628 int32_t element_size =
602 convertToUint(self->Get(String::New("BYTES_PER_ELEMENT")), &try_catch); 629 convertToUint(self->Get(Symbols::BYTES_PER_ELEMENT), &try_catch);
603 if (try_catch.HasCaught()) return try_catch.ReThrow(); 630 if (try_catch.HasCaught()) return try_catch.ReThrow();
604 631
605 if (args.Length() == 0) { 632 if (args.Length() == 0) {
606 return ThrowException( 633 return Throw("'subarray' must have at least one argument");
607 String::New("'subarray' must have at least one argument"));
608 } 634 }
609 int32_t begin = convertToInt(args[0], &try_catch); 635 int32_t begin = convertToInt(args[0], &try_catch);
610 if (try_catch.HasCaught()) return try_catch.ReThrow(); 636 if (try_catch.HasCaught()) return try_catch.ReThrow();
611 if (begin < 0) begin += length; 637 if (begin < 0) begin += length;
612 if (begin < 0) begin = 0; 638 if (begin < 0) begin = 0;
613 if (begin > length) begin = length; 639 if (begin > length) begin = length;
614 640
615 int32_t end; 641 int32_t end;
616 if (args.Length() < 2 || args[1]->IsUndefined()) { 642 if (args.Length() < 2 || args[1]->IsUndefined()) {
617 end = length; 643 end = length;
(...skipping 14 matching lines...) Expand all
632 buffer, Uint32::New(byteOffset), Uint32::New(length) 658 buffer, Uint32::New(byteOffset), Uint32::New(length)
633 }; 659 };
634 return constructor->NewInstance(3, construct_args); 660 return constructor->NewInstance(3, construct_args);
635 } 661 }
636 662
637 663
638 Handle<Value> Shell::ArraySet(const Arguments& args) { 664 Handle<Value> Shell::ArraySet(const Arguments& args) {
639 TryCatch try_catch; 665 TryCatch try_catch;
640 666
641 if (!args.This()->IsObject()) { 667 if (!args.This()->IsObject()) {
642 return ThrowException( 668 return Throw("'set' invoked on non-object receiver");
643 String::New("'set' invoked on non-object receiver"));
644 } 669 }
645 670
646 Local<Object> self = args.This(); 671 Local<Object> self = args.This();
647 Local<Value> marker = self->GetHiddenValue(String::New(kArrayMarkerPropName)); 672 Local<Value> marker = self->GetHiddenValue(Symbols::ArrayMarkerPropName);
648 if (marker.IsEmpty()) { 673 if (marker.IsEmpty()) {
649 return ThrowException( 674 return Throw("'set' invoked on wrong receiver type");
650 String::New("'set' invoked on wrong receiver type"));
651 } 675 }
652 int32_t length = 676 int32_t length =
653 convertToUint(self->Get(String::New("length")), &try_catch); 677 convertToUint(self->Get(Symbols::length), &try_catch);
654 if (try_catch.HasCaught()) return try_catch.ReThrow(); 678 if (try_catch.HasCaught()) return try_catch.ReThrow();
655 int32_t element_size = 679 int32_t element_size =
656 convertToUint(self->Get(String::New("BYTES_PER_ELEMENT")), &try_catch); 680 convertToUint(self->Get(Symbols::BYTES_PER_ELEMENT), &try_catch);
657 if (try_catch.HasCaught()) return try_catch.ReThrow(); 681 if (try_catch.HasCaught()) return try_catch.ReThrow();
658 682
659 if (args.Length() == 0) { 683 if (args.Length() == 0) {
660 return ThrowException( 684 return Throw("'set' must have at least one argument");
661 String::New("'set' must have at least one argument"));
662 } 685 }
663 if (!args[0]->IsObject() || 686 if (!args[0]->IsObject() ||
664 !args[0]->ToObject()->Has(String::New("length"))) { 687 !args[0]->ToObject()->Has(Symbols::length)) {
665 return ThrowException( 688 return Throw("'set' invoked with non-array argument");
666 String::New("'set' invoked with non-array argument"));
667 } 689 }
668 Handle<Object> source = args[0]->ToObject(); 690 Handle<Object> source = args[0]->ToObject();
669 int32_t source_length = 691 int32_t source_length =
670 convertToUint(source->Get(String::New("length")), &try_catch); 692 convertToUint(source->Get(Symbols::length), &try_catch);
671 if (try_catch.HasCaught()) return try_catch.ReThrow(); 693 if (try_catch.HasCaught()) return try_catch.ReThrow();
672 694
673 int32_t offset; 695 int32_t offset;
674 if (args.Length() < 2 || args[1]->IsUndefined()) { 696 if (args.Length() < 2 || args[1]->IsUndefined()) {
675 offset = 0; 697 offset = 0;
676 } else { 698 } else {
677 offset = convertToUint(args[1], &try_catch); 699 offset = convertToUint(args[1], &try_catch);
678 if (try_catch.HasCaught()) return try_catch.ReThrow(); 700 if (try_catch.HasCaught()) return try_catch.ReThrow();
679 } 701 }
680 if (offset + source_length > length) { 702 if (offset + source_length > length) {
681 return ThrowException(String::New("offset or source length out of bounds")); 703 return Throw("offset or source length out of bounds");
682 } 704 }
683 705
684 int32_t source_element_size; 706 int32_t source_element_size;
685 if (source->GetHiddenValue(String::New(kArrayMarkerPropName)).IsEmpty()) { 707 if (source->GetHiddenValue(Symbols::ArrayMarkerPropName).IsEmpty()) {
686 source_element_size = 0; 708 source_element_size = 0;
687 } else { 709 } else {
688 source_element_size = 710 source_element_size =
689 convertToUint(source->Get(String::New("BYTES_PER_ELEMENT")), &try_catch); 711 convertToUint(source->Get(Symbols::BYTES_PER_ELEMENT), &try_catch);
690 if (try_catch.HasCaught()) return try_catch.ReThrow(); 712 if (try_catch.HasCaught()) return try_catch.ReThrow();
691 } 713 }
692 714
693 if (element_size == source_element_size && 715 if (element_size == source_element_size &&
694 self->GetConstructor()->StrictEquals(source->GetConstructor())) { 716 self->GetConstructor()->StrictEquals(source->GetConstructor())) {
695 // Use memmove on the array buffers. 717 // Use memmove on the array buffers.
696 Handle<Object> buffer = self->Get(String::New("buffer"))->ToObject(); 718 Handle<Object> buffer = self->Get(Symbols::buffer)->ToObject();
697 if (try_catch.HasCaught()) return try_catch.ReThrow(); 719 if (try_catch.HasCaught()) return try_catch.ReThrow();
698 Handle<Object> source_buffer = 720 Handle<Object> source_buffer =
699 source->Get(String::New("buffer"))->ToObject(); 721 source->Get(Symbols::buffer)->ToObject();
700 if (try_catch.HasCaught()) return try_catch.ReThrow(); 722 if (try_catch.HasCaught()) return try_catch.ReThrow();
701 int32_t byteOffset = 723 int32_t byteOffset =
702 convertToUint(self->Get(String::New("byteOffset")), &try_catch); 724 convertToUint(self->Get(Symbols::byteOffset), &try_catch);
703 if (try_catch.HasCaught()) return try_catch.ReThrow(); 725 if (try_catch.HasCaught()) return try_catch.ReThrow();
704 int32_t source_byteOffset = 726 int32_t source_byteOffset =
705 convertToUint(source->Get(String::New("byteOffset")), &try_catch); 727 convertToUint(source->Get(Symbols::byteOffset), &try_catch);
706 if (try_catch.HasCaught()) return try_catch.ReThrow(); 728 if (try_catch.HasCaught()) return try_catch.ReThrow();
707 729
708 uint8_t* dest = byteOffset + offset * element_size + static_cast<uint8_t*>( 730 uint8_t* dest = byteOffset + offset * element_size + static_cast<uint8_t*>(
709 buffer->GetIndexedPropertiesExternalArrayData()); 731 buffer->GetIndexedPropertiesExternalArrayData());
710 uint8_t* src = source_byteOffset + static_cast<uint8_t*>( 732 uint8_t* src = source_byteOffset + static_cast<uint8_t*>(
711 source_buffer->GetIndexedPropertiesExternalArrayData()); 733 source_buffer->GetIndexedPropertiesExternalArrayData());
712 memmove(dest, src, source_length * element_size); 734 memmove(dest, src, source_length * element_size);
713 } else if (source_element_size == 0) { 735 } else if (source_element_size == 0) {
714 // Source is not a typed array, copy element-wise sequentially. 736 // Source is not a typed array, copy element-wise sequentially.
715 for (int i = 0; i < source_length; ++i) { 737 for (int i = 0; i < source_length; ++i) {
716 self->Set(offset + i, source->Get(i)); 738 self->Set(offset + i, source->Get(i));
717 if (try_catch.HasCaught()) return try_catch.ReThrow(); 739 if (try_catch.HasCaught()) return try_catch.ReThrow();
718 } 740 }
719 } else { 741 } else {
720 // Need to copy element-wise to make the right conversions. 742 // Need to copy element-wise to make the right conversions.
721 Handle<Object> buffer = self->Get(String::New("buffer"))->ToObject(); 743 Handle<Object> buffer = self->Get(Symbols::buffer)->ToObject();
722 if (try_catch.HasCaught()) return try_catch.ReThrow(); 744 if (try_catch.HasCaught()) return try_catch.ReThrow();
723 Handle<Object> source_buffer = 745 Handle<Object> source_buffer =
724 source->Get(String::New("buffer"))->ToObject(); 746 source->Get(Symbols::buffer)->ToObject();
725 if (try_catch.HasCaught()) return try_catch.ReThrow(); 747 if (try_catch.HasCaught()) return try_catch.ReThrow();
726 748
727 if (buffer->StrictEquals(source_buffer)) { 749 if (buffer->StrictEquals(source_buffer)) {
728 // Same backing store, need to handle overlap correctly. 750 // Same backing store, need to handle overlap correctly.
729 // This gets a bit tricky in the case of different element sizes 751 // This gets a bit tricky in the case of different element sizes
730 // (which, of course, is extremely unlikely to ever occur in practice). 752 // (which, of course, is extremely unlikely to ever occur in practice).
731 int32_t byteOffset = 753 int32_t byteOffset =
732 convertToUint(self->Get(String::New("byteOffset")), &try_catch); 754 convertToUint(self->Get(Symbols::byteOffset), &try_catch);
733 if (try_catch.HasCaught()) return try_catch.ReThrow(); 755 if (try_catch.HasCaught()) return try_catch.ReThrow();
734 int32_t source_byteOffset = 756 int32_t source_byteOffset =
735 convertToUint(source->Get(String::New("byteOffset")), &try_catch); 757 convertToUint(source->Get(Symbols::byteOffset), &try_catch);
736 if (try_catch.HasCaught()) return try_catch.ReThrow(); 758 if (try_catch.HasCaught()) return try_catch.ReThrow();
737 759
738 // Copy as much as we can from left to right. 760 // Copy as much as we can from left to right.
739 int i = 0; 761 int i = 0;
740 int32_t next_dest_offset = byteOffset + (offset + 1) * element_size; 762 int32_t next_dest_offset = byteOffset + (offset + 1) * element_size;
741 int32_t next_src_offset = source_byteOffset + source_element_size; 763 int32_t next_src_offset = source_byteOffset + source_element_size;
742 while (i < length && next_dest_offset <= next_src_offset) { 764 while (i < length && next_dest_offset <= next_src_offset) {
743 self->Set(offset + i, source->Get(i)); 765 self->Set(offset + i, source->Get(i));
744 ++i; 766 ++i;
745 next_dest_offset += element_size; 767 next_dest_offset += element_size;
(...skipping 26 matching lines...) Expand all
772 } 794 }
773 } 795 }
774 796
775 return Undefined(); 797 return Undefined();
776 } 798 }
777 799
778 800
779 void Shell::ExternalArrayWeakCallback(Persistent<Value> object, void* data) { 801 void Shell::ExternalArrayWeakCallback(Persistent<Value> object, void* data) {
780 HandleScope scope; 802 HandleScope scope;
781 int32_t length = 803 int32_t length =
782 object->ToObject()->Get(String::New("byteLength"))->Uint32Value(); 804 object->ToObject()->Get(Symbols::byteLength)->Uint32Value();
783 V8::AdjustAmountOfExternalAllocatedMemory(-length); 805 V8::AdjustAmountOfExternalAllocatedMemory(-length);
784 delete[] static_cast<uint8_t*>(data); 806 delete[] static_cast<uint8_t*>(data);
785 object.Dispose(); 807 object.Dispose();
786 } 808 }
787 809
788 810
789 Handle<Value> Shell::Int8Array(const Arguments& args) { 811 Handle<Value> Shell::Int8Array(const Arguments& args) {
790 return CreateExternalArray(args, v8::kExternalByteArray, sizeof(int8_t)); 812 return CreateExternalArray(args, v8::kExternalByteArray, sizeof(int8_t));
791 } 813 }
792 814
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
1158 global_template->Set(String::New("quit"), FunctionTemplate::New(Quit)); 1180 global_template->Set(String::New("quit"), FunctionTemplate::New(Quit));
1159 global_template->Set(String::New("version"), FunctionTemplate::New(Version)); 1181 global_template->Set(String::New("version"), FunctionTemplate::New(Version));
1160 global_template->Set(String::New("enableProfiler"), 1182 global_template->Set(String::New("enableProfiler"),
1161 FunctionTemplate::New(EnableProfiler)); 1183 FunctionTemplate::New(EnableProfiler));
1162 global_template->Set(String::New("disableProfiler"), 1184 global_template->Set(String::New("disableProfiler"),
1163 FunctionTemplate::New(DisableProfiler)); 1185 FunctionTemplate::New(DisableProfiler));
1164 1186
1165 // Bind the handlers for external arrays. 1187 // Bind the handlers for external arrays.
1166 PropertyAttribute attr = 1188 PropertyAttribute attr =
1167 static_cast<PropertyAttribute>(ReadOnly | DontDelete); 1189 static_cast<PropertyAttribute>(ReadOnly | DontDelete);
1168 global_template->Set(String::New("ArrayBuffer"), 1190 global_template->Set(Symbols::ArrayBuffer,
1169 CreateArrayBufferTemplate(ArrayBuffer), attr); 1191 CreateArrayBufferTemplate(ArrayBuffer), attr);
1170 global_template->Set(String::New("Int8Array"), 1192 global_template->Set(String::New("Int8Array"),
1171 CreateArrayTemplate(Int8Array), attr); 1193 CreateArrayTemplate(Int8Array), attr);
1172 global_template->Set(String::New("Uint8Array"), 1194 global_template->Set(String::New("Uint8Array"),
1173 CreateArrayTemplate(Uint8Array), attr); 1195 CreateArrayTemplate(Uint8Array), attr);
1174 global_template->Set(String::New("Int16Array"), 1196 global_template->Set(String::New("Int16Array"),
1175 CreateArrayTemplate(Int16Array), attr); 1197 CreateArrayTemplate(Int16Array), attr);
1176 global_template->Set(String::New("Uint16Array"), 1198 global_template->Set(String::New("Uint16Array"),
1177 CreateArrayTemplate(Uint16Array), attr); 1199 CreateArrayTemplate(Uint16Array), attr);
1178 global_template->Set(String::New("Int32Array"), 1200 global_template->Set(String::New("Int32Array"),
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
1216 Shell::counter_map_ = new CounterMap(); 1238 Shell::counter_map_ = new CounterMap();
1217 // Set up counters 1239 // Set up counters
1218 if (i::StrLength(i::FLAG_map_counters) != 0) 1240 if (i::StrLength(i::FLAG_map_counters) != 0)
1219 MapCounters(i::FLAG_map_counters); 1241 MapCounters(i::FLAG_map_counters);
1220 if (i::FLAG_dump_counters || i::FLAG_track_gc_object_stats) { 1242 if (i::FLAG_dump_counters || i::FLAG_track_gc_object_stats) {
1221 V8::SetCounterFunction(LookupCounter); 1243 V8::SetCounterFunction(LookupCounter);
1222 V8::SetCreateHistogramFunction(CreateHistogram); 1244 V8::SetCreateHistogramFunction(CreateHistogram);
1223 V8::SetAddHistogramSampleFunction(AddHistogramSample); 1245 V8::SetAddHistogramSampleFunction(AddHistogramSample);
1224 } 1246 }
1225 #endif // V8_SHARED 1247 #endif // V8_SHARED
1248
1249 Symbols::Initialize();
1226 if (options.test_shell) return; 1250 if (options.test_shell) return;
1227 1251
1228 #ifndef V8_SHARED 1252 #ifndef V8_SHARED
1229 Locker lock; 1253 Locker lock;
1230 HandleScope scope; 1254 HandleScope scope;
1231 Handle<ObjectTemplate> global_template = CreateGlobalTemplate(); 1255 Handle<ObjectTemplate> global_template = CreateGlobalTemplate();
1232 utility_context_ = Context::New(NULL, global_template); 1256 utility_context_ = Context::New(NULL, global_template);
1233 1257
1234 #ifdef ENABLE_DEBUGGER_SUPPORT 1258 #ifdef ENABLE_DEBUGGER_SUPPORT
1235 // Start the debugger agent if requested. 1259 // Start the debugger agent if requested.
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
1374 *size_out = size; 1398 *size_out = size;
1375 return chars; 1399 return chars;
1376 } 1400 }
1377 1401
1378 1402
1379 Handle<Value> Shell::ReadBuffer(const Arguments& args) { 1403 Handle<Value> Shell::ReadBuffer(const Arguments& args) {
1380 ASSERT(sizeof(char) == sizeof(uint8_t)); // NOLINT 1404 ASSERT(sizeof(char) == sizeof(uint8_t)); // NOLINT
1381 String::Utf8Value filename(args[0]); 1405 String::Utf8Value filename(args[0]);
1382 int length; 1406 int length;
1383 if (*filename == NULL) { 1407 if (*filename == NULL) {
1384 return ThrowException(String::New("Error loading file")); 1408 return Throw("Error loading file");
1385 } 1409 }
1386 1410
1387 uint8_t* data = reinterpret_cast<uint8_t*>(ReadChars(*filename, &length)); 1411 uint8_t* data = reinterpret_cast<uint8_t*>(ReadChars(*filename, &length));
1388 if (data == NULL) { 1412 if (data == NULL) {
1389 return ThrowException(String::New("Error reading file")); 1413 return Throw("Error reading file");
1390 } 1414 }
1391 Handle<Object> buffer = Object::New(); 1415 Handle<Object> buffer = Object::New();
1392 buffer->SetHiddenValue(String::New(kArrayBufferMarkerPropName), True()); 1416 buffer->SetHiddenValue(Symbols::ArrayBufferMarkerPropName, True());
1393 Persistent<Object> persistent_buffer = Persistent<Object>::New(buffer); 1417 Persistent<Object> persistent_buffer = Persistent<Object>::New(buffer);
1394 persistent_buffer.MakeWeak(data, ExternalArrayWeakCallback); 1418 persistent_buffer.MakeWeak(data, ExternalArrayWeakCallback);
1395 persistent_buffer.MarkIndependent(); 1419 persistent_buffer.MarkIndependent();
1396 V8::AdjustAmountOfExternalAllocatedMemory(length); 1420 V8::AdjustAmountOfExternalAllocatedMemory(length);
1397 1421
1398 buffer->SetIndexedPropertiesToExternalArrayData( 1422 buffer->SetIndexedPropertiesToExternalArrayData(
1399 data, kExternalUnsignedByteArray, length); 1423 data, kExternalUnsignedByteArray, length);
1400 buffer->Set(String::New("byteLength"), 1424 buffer->Set(Symbols::byteLength,
1401 Int32::New(static_cast<int32_t>(length)), ReadOnly); 1425 Int32::New(static_cast<int32_t>(length)), ReadOnly);
1402 return buffer; 1426 return buffer;
1403 } 1427 }
1404 1428
1405 1429
1406 #ifndef V8_SHARED 1430 #ifndef V8_SHARED
1407 static char* ReadToken(char* data, char token) { 1431 static char* ReadToken(char* data, char token) {
1408 char* next = i::OS::StrChr(data, token); 1432 char* next = i::OS::StrChr(data, token);
1409 if (next != NULL) { 1433 if (next != NULL) {
1410 *next = '\0'; 1434 *next = '\0';
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after
1888 || !options.script_executed ) 1912 || !options.script_executed )
1889 && !options.test_shell ) { 1913 && !options.test_shell ) {
1890 #if !defined(V8_SHARED) && defined(ENABLE_DEBUGGER_SUPPORT) 1914 #if !defined(V8_SHARED) && defined(ENABLE_DEBUGGER_SUPPORT)
1891 if (!i::FLAG_debugger) { 1915 if (!i::FLAG_debugger) {
1892 InstallUtilityScript(); 1916 InstallUtilityScript();
1893 } 1917 }
1894 #endif // !V8_SHARED && ENABLE_DEBUGGER_SUPPORT 1918 #endif // !V8_SHARED && ENABLE_DEBUGGER_SUPPORT
1895 RunShell(); 1919 RunShell();
1896 } 1920 }
1897 1921
1922 Symbols::TearDown();
1898 V8::Dispose(); 1923 V8::Dispose();
1899 1924
1900 #ifndef V8_SHARED 1925 #ifndef V8_SHARED
1901 OnExit(); 1926 OnExit();
1902 #endif // V8_SHARED 1927 #endif // V8_SHARED
1903 1928
1904 return result; 1929 return result;
1905 } 1930 }
1906 1931
1907 } // namespace v8 1932 } // namespace v8
1908 1933
1909 1934
1910 #ifndef GOOGLE3 1935 #ifndef GOOGLE3
1911 int main(int argc, char* argv[]) { 1936 int main(int argc, char* argv[]) {
1912 return v8::Shell::Main(argc, argv); 1937 return v8::Shell::Main(argc, argv);
1913 } 1938 }
1914 #endif 1939 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698